On Wed, Feb 11, 2009 at 2:30 PM, Joshua Russo <joshua.rupp...@gmail.com>wrote:

> Thanks so much. I think you are right. I will let you know tomorrow if
> I was able to fix it. I just need to figure out where the encoding is
> set in NetBeans and Textpad. I use a combination of both of them.
>
> It's possible that I didn't have the "u" when I created the message,
> though I was receiving an error of some sort with and without the "u".
>

Yes, you would get an error both with and without the u'', just at different
times, and the one you showed was the one you would get without the u'', not
with it.

When you specify an encoding declaration of utf-8 in the file, and use u''
around a string that is not in fact utf-8 encoded, the Python interpreter
will raise an error when you try to import the file.  Python uses the
encoding declaration for the file to decode the string inside the u'' when
the file is loaded; if the string can't be decoded using the file-declared
encoding, you'll get an error.  But that is not the error your reported.

If you don't use u'' around the string, Python doesn't do anything special
with it when the file is imported, it's just a bytestring.  Later on when
Django has to convert it to unicode, it tries to do so assuming a utf-8
encoding, which will fail if the string isn't utf-8 encoded.  This is the
error you reported.

Karen

--~--~---------~--~----~------------~-------~--~----~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to