Opened 10 years ago

Closed 10 years ago

#23769 closed Bug (invalid)

String with unicode is not passed to template from a view

Reported by: Ajin Abraham Owned by: nobody
Component: Template system Version: 1.7
Severity: Normal Keywords: unicode, encoding
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

When a string that contains some unicode symbols is passed from a view to a template. The whole data get ignored and won't get rendered in the template.

A quick fix is to decode to 'windows-1252' and then encode to 'utf8'
example:
# x is a string that contain unicode like "«»"
x=x.decode("windows-1252").encode("utf8")

It's better to be handled internally than a user doing it, else there should be some errors mentioning the issue rather than just ignoring the whole data.

Change History (2)

comment:1 by Ajin Abraham, 10 years ago

comment:2 by Claude Paroz, 10 years ago

Resolution: invalid
Status: newclosed

You are probably including non-ASCII strings without the u"" prefix, and this is not supported (this issue will disappear in Python 3).

Note: See TracTickets for help on using tickets.
Back to Top