Created on 2014-10-15.18:44:47 by nullquery, last changed 2015-04-24.14:18:27 by eaaltonen.
I'm trying to use Jython as an embedded scripting language in my web application. To do this I'm using the PythonInterpreter class.
On Jython 2.7-b3 (also tested on 2.7-b2) when I create a new PythonInterpreter object the following appears in my console:
console: Failed to install '': java.nio.charset.UnsupportedCharsetException: cp0.
The problem does not occur in 2.5.4-rc1.
I've already tried searching for more information, but very little seems to be known about this issue and there doesn't seem to be a way to configure the character encoding(?), and it worked in a previous version without the message, so I'm assuming it's a bug.
||Author: Jeff Allen (jeff.allen)
I get this a lot when testing under Eclipse, but not at a real console. My usual solution is to add -Dpython.console.encoding=UTF-8 (or whatever) as a JVM parameter. But you can do it in the (Jython) registry too.
Jython's sys module looks in several places for the console encoding. If nothing tells it the encoding explicitly, it asks Java, here:
Unfortunately, when Windows returns code page zero, Java claims to know that the encoding is cp0.
Maybe we should convert that special case to null here, so that Jython will next consult file.encoding. I *think* this is what the outcome of CPython 6501 amounts to (http://bugs.python.org/issue6501).
Note: in Eclipse you need to set '-Dpython.console.encoding=UTF-8' to "Installed JREs". _Not_ in eclipse.ini.