Opened 18 years ago
Closed 18 years ago
#125 closed defect (fixed)
Can't use unicode objects to construct a template
Reported by: | nkantrowitz <kantrn@…> | Owned by: | cmlenz |
---|---|---|---|
Priority: | major | Milestone: | 0.4.2 |
Component: | Template processing | Version: | 0.4 |
Keywords: | Cc: |
Description
A simple test case:
In [0]: from genshi.template.text import TextTemplate In [1]: TextTemplate(u'a\u00c4b') --------------------------------------------------------------------------- exceptions.UnicodeEncodeError Traceback (most recent call last) /Users/coderanger/Documents/Work/OLPC/gamejam/<ipython console> /opt/local/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/Genshi-0.4.1-py2.4.egg/genshi/template/base.py in __init__(self, source, basedir, filename, loader, encoding, lookup) /opt/local/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/Genshi-0.4.1-py2.4.egg/genshi/template/text.py in _parse(self, source, encoding) /opt/local/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/encodings/utf_8.py in decode(input, errors) 14 15 def decode(input, errors='strict'): ---> 16 return codecs.utf_8_decode(input, errors, True) 17 18 class StreamWriter(codecs.StreamWriter): UnicodeEncodeError: 'ascii' codec can't encode character u'\xc4' in position 1: ordinal not in range(128)
Attachments (1)
Change History (2)
Changed 18 years ago by cboos
comment:1 Changed 18 years ago by cmlenz
- Resolution set to fixed
- Status changed from new to closed
Note: See
TracTickets for help on using
tickets.
Proposed fix