Re: Problem with encoding and using ifequal in Django templates

2009-01-27 Thread Malcolm Tredinnick

On Tue, 2009-01-27 at 09:25 -0800, Ben Gerdemann wrote:
> Hello,
> 
> I'm having problems using {% ifequal s1 "some text" %} to compare
> strings with extended characters in Django templates. When string s1
> contains ascii characters >127, I get exceptions in the template
> rendering.

I know you've solved this yourself, but for future reference: there are
no such animals as "ASCII characters > 127". ASCII is a 7-bit encoding.
You could be talking about UTF-8 bytes or Unicode characters
(codepoints) in that range (or ISO-8859-1 or other encoding of choice),
but not ASCII.

Using the right terms for future problems will avoid any "wtf?!" moments
on the part of the readers.

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



Re: Problem with encoding and using ifequal in Django templates

2009-01-27 Thread Ben Gerdemann

Sometimes there's nothing like describing a problem to someone else to
help you solve it. :) I should have marked the Python strings as
Unicode like this and everything works now:

def test(request):
return render_to_response("test.html", {
"s1": u"dados",
"s2": u"aprovação",
}
  )


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---