On Tue, 2007-07-31 at 15:40 +0000, Mario Gonzalez wrote:
> Hello, I'm getting some problems with unicode in templates: 'ascii'
> codec can't encode character u'\xf1' in position 1: ordinal not in
> range(128)  However, templates, database are in UTF8. I changed
> __str__ by __unicode__ in my models files.
> 
>   Django (I think) is trying to encode an ascii string. I modified
> django/template/__init__.py line 704 and just for testing purposes I
> deleted raise and I changed it by print e

It's going to be almost impossible for anybody other than you to debug
this based on the information you have given: we have no way to
replicate the problem.

The easiest way to get help here is to reduce your template to the
smallest possible example required to reproduce the problem. Start
removing lines (in particular static text) until the problem goes away.
Then go back one step. I would guess that the error is being triggered
by some dynamic content you are putting in (a variable substitution or
filter output). Once you have reduce the situation to a minimum, that
should be easy enough to spot. Then work out what the content is that is
being substituted in.

There may well be a problem, but from the current information there is a
0% chance of anybody being able to guess the solution. There are just
too many things it could be from bad strings in your code to bad
handling on some uncommon code path in Django to some inadvertent
encoding mismatch somewhere else. So if you can come up with a small
reproducible test case, that will help greatly.

Regards,
Malcolm


--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to