Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.

#1 Dec. 3, 2010 14:35:25

Robin B.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

weird template escaping


Hi, I have a custom Form that's attempting to expand the following

field.label=u'Elegant, sophisticated, discover Egypt\u2019s local customs'

in a template. The template code looks like


<div class="label">{{ field.label }}</div>using some special debugging tricks I can determine that, immediately prior tothe expansion, the field.label value is still in unicode and has the right value.However, when the expansion takes place I see the following in the output html

<div class="label">

Elegant, sophisticated, discover Egyptâ€&trade;s local customs
</div>

so it looks as though something is being silly and doing the following1) translate to utf8 ie 'Elegant, sophisticated, discover Egypt\xe2\x80\x99slocal customs'2) escaping \x99 as &trade; (trademark char is &#153; == &#x99;)

where should I start looking to locate the problem?
--
Robin Becker

--
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 athttp://groups.google.com/group/django-users?hl=en.

Offline

#2 Dec. 3, 2010 16:47:02

w.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

weird template escaping


Turn autoescape off (http://docs.djangoproject.com/en/dev/ref/templates/builtins/?from=olddocs#autoescape) or mark it as safe by
using the "safe" template filter tag (lower on the page).

--
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 athttp://groups.google.com/group/django-users?hl=en.

Offline

Board footer

Moderator control

Enjoy the 21st of August
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support