Title: Printing UTF-8 string from Java to Python using PythonInterpreter broken
Type: behaviour Severity: normal
Components: Library Versions: Jython 2.5
Status: closed Resolution: invalid
Dependencies: Superseder:
Assigned To: Nosy List: alex.gronholm, fwierzbicki, kga.official, zyasoft
Priority: Keywords:

Created on 2012-11-26.04:03:17 by kga.official, last changed 2015-04-14.03:19:26 by zyasoft.

File name Uploaded Description Edit Remove kga.official, 2012-11-26.04:03:17 Sample Program
notWorking2.5.jpg kga.official, 2012-11-26.04:10:29 not working output
workingIn2.2rc3.jpg kga.official, 2012-11-26.04:10:54 working output
CodeInUTF8Editor.jpg kga.official, 2012-11-26.04:12:08 Code Screenshot in Eclipse
msg7533 (view) Author: kga.official (kga.official) Date: 2012-11-26.04:03:16
Jython 2.5.x breaks earlier behavior of printing UTF-8 characters from Java into Python using org.python.util.PythonInterpreter 
2.2rc3 works fine. Sample Program attached. (Will attach sample outputs using 2.2 and 2.5.3 after submission).
This is a regression, seems important.
msg7534 (view) Author: kga.official (kga.official) Date: 2012-11-26.04:10:29
Output screenshot of not working Jython library 2.5.3
msg7535 (view) Author: kga.official (kga.official) Date: 2012-11-26.04:10:54
Output screenshot of _wroking_ 2.2rc3 library.
msg7536 (view) Author: kga.official (kga.official) Date: 2012-11-26.04:12:08
Screenshot of Java code opened in Eclipse as UTF-8 file. This is so that you can easily see the input and compare to output.
msg7986 (view) Author: Alex Grönholm (alex.gronholm) Date: 2013-04-05.21:36:40
Does the same happen if you use unicode sequences in place of UTF-8? Java's source encoding is not explicitly defined, so unicode sequences should be used if non-ASCII characters are needed in literals.
msg8337 (view) Author: kga.official (kga.official) Date: 2014-05-05.03:33:49
Sorry for the delayed reply, my project specifies UTF-8 encoding as the source code encoding. I haven't tried Unicode Sequences, will do when I get the opportunity. 
Thanks for looking into this.
msg8695 (view) Author: Jim Baker (zyasoft) Date: 2014-06-19.01:10:44
I don't think executing this statement:

interp.exec("# coding=utf-8") 

is going to do anything, certainly not for subsequent code. In general PythonInterpreter works with unicode; you can control the encoding of the underlying stdin/stdout/stderr by setting accordingly with setEncoding.
msg9825 (view) Author: Alex Grönholm (alex.gronholm) Date: 2015-04-14.02:19:34
The only reason this was working in 2.2 is because all strings were unicode strings back then. So, we should close this as invalid, yes?
msg9829 (view) Author: Jim Baker (zyasoft) Date: 2015-04-14.03:19:26
Makes sense to me. Let's close out.
Date User Action Args
2015-04-14 03:19:26zyasoftsetstatus: open -> closed
resolution: remind -> invalid
messages: + msg9829
2015-04-14 02:19:34alex.gronholmsetmessages: + msg9825
2014-06-19 01:10:44zyasoftsetnosy: + zyasoft
messages: + msg8695
2014-05-05 03:33:49kga.officialsetmessages: + msg8337
2013-04-05 21:36:40alex.gronholmsetnosy: + alex.gronholm
messages: + msg7986
2013-02-19 19:12:06fwierzbickisetversions: + Jython 2.5, - 2.5.1, 2.5.0, 2.5.2, 2.5.3b1, 2.5.3b2
2013-02-19 19:11:46fwierzbickisetnosy: + fwierzbicki
resolution: remind
2012-11-26 04:12:08kga.officialsetfiles: + CodeInUTF8Editor.jpg
messages: + msg7536
2012-11-26 04:10:54kga.officialsetfiles: + workingIn2.2rc3.jpg
messages: + msg7535
2012-11-26 04:10:29kga.officialsetfiles: + notWorking2.5.jpg
messages: + msg7534
2012-11-26 04:03:17kga.officialcreate