Edgewall Software

Ticket #125 (closed defect: fixed)

Opened 7 years ago

Last modified 7 years ago

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

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

Change History

Changed 7 years ago by cboos

Proposed fix

Changed 7 years ago by cmlenz

  • status changed from new to closed
  • resolution set to fixed

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

Add/Change #125 (Can't use unicode objects to construct a template)

Author


E-mail address and user name can be saved in the Preferences.


Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
 
Note: See TracTickets for help on using tickets.