Message3846

Author rose.pan
Recipients rose.pan
Date 2008-11-24.22:47:06
SpamBayes Score 5.4675153e-11
Marked as misclassified No
Message-id <1227566827.65.0.104694116454.issue1183@psf.upfronthosting.co.za>
In-reply-to
Content
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, test.py file. The test.py file
defines a function called create() which simply returns the value of the
parameter:

======= start of test.py   ======
def create(name):
     return name
======= end of test.py  =====

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("test.py")
>>> 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("test.py")
>>> 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.
History
Date User Action Args
2008-11-24 22:47:07rose.pansetrecipients: + rose.pan
2008-11-24 22:47:07rose.pansetmessageid: <1227566827.65.0.104694116454.issue1183@psf.upfronthosting.co.za>
2008-11-24 22:47:07rose.panlinkissue1183 messages
2008-11-24 22:47:07rose.pancreate