Thursday, October 28, 2010

Re: Famous 'ascii' codec can't decode byte 0xc3 error

On Thu, Oct 28, 2010 at 11:41 AM, Duong Dang <dang.duong@gmail.com> wrote:
> Hi,
>
> I am having the following unicode error with django 1.2:
>
> ./standalone.py print the string out just fine. But in in my app, when
> ever mymodel.update() is called I get this famous error: 'ascii' codec
> can't decode byte 0xc3
>
> Thanks
>
>
> standalone.py:
> # -*- coding: utf-8 -
> *-
> def unicodestring():
>   blah blah
>   an_unicode_string  = "%s %s %s"%(s1,s2,s3)
>   return an_unicode_string

an_unicode_string is not a unicode string. unicode strings are defined
like this: u"foo".

>
> if __name__=="__main__":
>    print unicodestring()
>
> ---
> somedjangoapp/models.py:
> # -*- coding: utf-8 -*-
> from django.db import
> models
> class SomeModel(models.Model)
>    blahblah
>    def update(self)
>         foo = unicodestring()
>         return
>
> --
> You received this message because you are subscribed to the Google Groups "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
>
>

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment