#6235 closed (invalid)
Unicode error when report template error.
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | Template system | Version: | dev |
Severity: | Keywords: | unicode, template | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
When a template error occurred, and a non english char in this template(i.e. Chinese chars), The error report page is not report the template error, instead of a unicode error. I found it can be fixed in django\template\context.py(line:18):
def __repr__(self): try: return repr(self.dicts) #This line cause unicode error when shows non english char.!!! except: return 'Ohhh: Context text...'
Change History (3)
comment:1 by , 17 years ago
Keywords: | template added |
---|
comment:2 by , 17 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
Ticket reporter was asked for more information. No feedback since two months. Closing it. Please reopen if more information (reproduceable traceback)
is given.
comment:3 by , 17 years ago
I can confirm what thejaswi_puthraya wrote:
This template code (Unicode text in template body, but no endif tag)...
{% if django %} 世界中のコミュニティ
...results in the following:
TemplateSyntaxError at /django/ Unclosed tag 'if'. Looking for one of: else, endif
As described in Case-2, adding Unicode text inside a tag...
{% if 世界中のコミュニティ %}it works{% endif %}
...results in a UnicodeEncodeError.
UnicodeEncodeError at /django/ 'ascii' codec can't encode characters in position 0-9: ordinal not in range(128)
It could be that flytwokites was inserted text in one of the non-Unicode Chinese encodings (GB18030, Big5) in templates. That's not Unicode, so wouldn't be something we'd support anyway.
Replying to flytwokites <towjzhou@hotmail.com>:
It would help if you give specific information. I have tried two cases and I am unable to replicate your error:
Case-1
If you are getting an error in this case, I can't reproduce it.
Case-2
If that is what you are looking at, i don't think it is possible to do it in the templating language.