From: Charlie G. <cha...@gm...> - 2008-12-22 19:57:14
|
Hi Rose, On Wed, Dec 17, 2008 at 4:37 PM, Rose Pan <ros...@or...> wrote: > Jython 2.2.1 cannot pass a unicode String correctly to a function > defined in a py script. The value of the parameter is converted to > different \x format. You're actually not passing unicode strings to the function. To create a unicode string in Python, you prepend u to it. > create('\u4f7f\u7528') <-- input Japanese characters This should be changed to create(u'\u4f7f\u7528'). If I do that, I get a unicode string out of the create function using Jython 2.2. Jython 2.1's implementation had a bug in it that allowed unicode strings to be passed around in a byte string e.g. those created with str or quotes with no u, and it had undefined behavior when converting into real bytes. This was fixed in 2.2. Charlie |