Edgewall Software

Opened 17 years ago

Closed 17 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)

unicode_input_for_text_template-r611.diff (1.3 KB) - added by cboos 17 years ago.
Proposed fix

Download all attachments as: .zip

Change History (2)

Changed 17 years ago by cboos

Proposed fix

comment:1 Changed 17 years ago by cmlenz

  • Resolution set to fixed
  • Status changed from new to closed

Patch applied in [616], ported to 0.4.x in [617].

Note: See TracTickets for help on using tickets.