On Thu, Nov 12, 2009 at 4:30 PM, rebus_ <r.dav...@gmail.com> wrote: > 2009/11/12 NMarcu <marcu.nico...@gmail.com>: > > Hello all, > > > > How to use French accent on django template? It's very strange. in > > one template is working very well, but in other(templatetag) not, I > > got this error: > > > > TemplateSyntaxError at /operators/ajax > > > > Caught an exception while rendering: 'ascii' codec can't encode > > character u'\xe9' in position 2: ordinal not in range(128) > > > > > > Do you have any idea what I'm doing wrong? > > My template look like this: > > {% load i18n %} > > <th class="editable_field"> > > {{ column.caption }} > > {% if column.href %} > > <a href="{{ column.href }}">Sort</a> > > {% endif %} > > {% if column.filtered %} > > (filtered) > > {% endif %} > > </th> > > > > {{ column.caption }} -> return a French word. > > > > -- > > Is column.caption unicode string? > Also does this happen when you call AJAX view or while rendering? > Perhaps you need to explicitly set encoding of python source files by > putting # -*- coding: utf-8 -*- at the top of the file. >
Clearly it isn't unicode - \xe9 is é in latin1/iso 8859-1. Does this come from the database by any chance? Is the database mysql? If so, is the default charset of the {db,connection,client} set to latin1? Cheers Tom -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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=.