Title: Jython 2.2.1 cannot pass unicode to a func in a py file
Type: behaviour Severity: normal
Components: Core Versions: 2.2.2
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: pjenvey, rose.pan
Priority: normal Keywords:

Created on 2008-11-24.22:47:07 by rose.pan, last changed 2009-06-21.21:52:40 by pjenvey.

msg3846 (view) Author: (rose.pan) Date: 2008-11-24.22:47:06
Jython 2.2.1 cannot pass a unicode String to a function defined in a py
script as a parameter. The value of the parameter is converted to
different \x format. This is not happened in Jython 2.1.

To reproduce it, define a py script, file. The file
defines a function called create() which simply returns the value of the

======= start of   ======
def create(name):
     return name
======= end of  =====

Then start Jython 2.1 and run the function create() from the py file:

java -classpath jython.jar.2.1 org.python.util.jython
Jython 2.1 on java1.6.0_05 (JIT: null)
>>> execfile("")
>>> create('\u4f7f\u7528')  <-- input Japanese characters
u'\u4F7F\u7528'             <-- return the same unicode representing the
                               Japanese characters with length 2

 We can see the output of create function returns a two-byte unicode.

Then we try Jython 2.2.1 with the same step:

java -classpath jython.jar.2.2.1 org.python.util.jython
Jython 2.2.1 on java1.6.0_05
>>> execfile("")
>>> create('\u4f7f\u7528')   <-- input Japanese characters
'\xBB\xC8\xCD\xD1'           <-- returns different values with length 4.

This is a regression for Jython 2.2.1.
msg4835 (view) Author: Philip Jenvey (pjenvey) Date: 2009-06-21.21:52:40
fixed in 2.5
Date User Action Args
2009-06-21 21:52:40pjenveysetstatus: open -> closed
resolution: fixed
messages: + msg4835
nosy: + pjenvey
2009-03-14 02:32:57fwierzbickisetpriority: normal
2008-11-24 22:47:07rose.pancreate