Also, don't forget about the magic functions provided by django: smart_unicode and smart_str
On Jan 5, 2:27 pm, Karen Tracey <kmtra...@gmail.com> wrote: > On Thu, Jan 5, 2012 at 8:16 AM, César Frias <cagfr...@gmail.com> wrote: > > I guess you have some files without the # -*- coding: utf-8 -*- on the top > > of the file > > > You will need this if you want to use some letters like é or ç... > > No, you get a different exception if you are missing the encoding > declaration in a Python file that contains non-ASCII characters. In that > case you get a SyntaxError that complains specifically about the missing > encoding declaration. > > Getting an error from the utf8 codec attempting to transform a bytestring > to unicode implies you've got some bytestring data that is assumed to be > encoded in utf8 but is in fact using some other encoding. Since this is > happening when rendering a template, my guess would be the template file's > encoding is something other than utf8. Django has a setting > (https://docs.djangoproject.com/en/1.3/ref/settings/#file-charset) that > controls what encoding is assumed for files read from disk, it defaults to > utf8. Either fix the encoding of the template file to be utf8 or change > that setting to match whatever encoding is being used for all your template > files on disk. > > 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.