str type used in composer.py - causing UnicodeDecodeErrors
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Singing & Dancing |
New
|
Undecided
|
Daniel Nouri |
Bug Description
trunk -r HEAD
I trapped the exception with some diagnostic to prove that its the header_text that's problematic. At this point it is a <str> and should be unicode. It's failing on EN DASH == \xe2\x80\x93
This may relate to the other UDE bugs around.
2008-12-02 16:20:22 ERROR collective.singing name : header_text exception : 'ascii' codec can't decode byte 0xe2 in position 1876: ordinal not in range(128) text <string.Template object at 0x9fb7f90>
Traceback (most recent call last):
File "/opt/zope/
subs(name)
File "/opt/zope/
vars[name] = string.
File "/opt/zope/
return self.pattern.
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 1876: ordinal not in range(128)
The traceback is here...
Traceback (innermost last):
Module ZPublisher.Publish, line 119, in publish
Module ZPublisher.mapply, line 88, in mapply
Module Products.
Module ZPublisher.Publish, line 42, in call_object
Module collective.
Module collective.
Module collective.
Module collective.
Module collective.
Module string, line 205, in safe_substitute
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 1876: ordinal not in range(128)
> /opt/zope/
-> return self.pattern.
and my diagnostic looked like this:
173 def subs(name):
174 vars[name] = string.
175 try:
176 for name in 'subject', 'header_text', 'footer_text':
177 subs(name)
178 except UnicodeDecodeError, ude:
179 logger.exception(' name : %s exception : %s text %s ' % (name, ude, string.
180 raise
I've done some debugging of my own, which reveals that the exception for me occurs in: sdb1/debug- singing/ collective. dancing/ trunk-buildout/ eggs/zope. i18n-3. 6.0-py2. 4.egg/zope/ i18n/__ init__. py(161) replace( ) mapping. get(param1 or param2, whole))
UnicodeDecodeError: 'ascii' codec can't decode byte 0xd7 in position 0: ordinal not in range(128)
> /media/
-> return unicode(
the piece of code is:
(Pdb) 156 u'This is ${name}' mapping. get(param1 or param2, whole)) regex.sub( replace, text)
157 """
158
159 def replace(match):
160 whole, param1, param2 = match.groups()
161 -> return unicode(
162
163 if not text or not mapping:
164 return text
165
166 return _interp_
and I can confirm this happens only when the title is set with hebrew text