Message1966

Author cgroves
Recipients
Date 2007-10-05.17:26:40
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
It was actually a bug that this worked in earlier versions.  Jython would blindly dump a unicode objects out to print when it should've run it through sys.defaultencoding to turn it into a str first.  This doesn't work for me on CPython either:

Python 2.5.1 (r251:54869, Apr 18 2007, 22:08:04)
[GCC 4.0.1 (Apple Computer, Inc. build 5367)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> print u"Num\u00e9ro requis."
Traceback (most recent call last):
 File "<stdin>", line 1, in <module>
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in
position 3: ordinal not in range(128)
>>>

It may work for you there because your defaultencoding is different.  You can do the same thing for Jython.  Edit your site.py to set defaultencoding to utf-8 or whatever it is in CPython.

I imagine Reportlab is expecting to have a defaultencoding that can handle unicode, or that you would handle the encoding on your own with an explicit encode call beforehand.
History
Date User Action Args
2008-02-20 17:18:04adminlinkissue1808214 messages
2008-02-20 17:18:04admincreate