Created on 2014-10-15.18:44:47 by nullquery, last changed 2015-04-24.14:18:27 by eaaltonen.
|msg9157 (view)||Author: (nullquery)||Date: 2014-10-15.18:44:47|
Hi, 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. Thanks.
|msg9159 (view)||Author: Jeff Allen (jeff.allen)||Date: 2014-10-17.20:08:47|
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: https://hg.python.org/jython/file/4ed64dc6c895/src/org/python/core/PySystemState.java#l829 Unfortunately, when Windows returns code page zero, Java claims to know that the encoding is cp0. http://hg.openjdk.java.net/jdk8/jdk8/jdk/file/687fd7c7986d/src/windows/native/java/io/Console_md.c#l61 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).
|msg9953 (view)||Author: (eaaltonen)||Date: 2015-04-24.14:18:27|
Note: in Eclipse you need to set '-Dpython.console.encoding=UTF-8' to "Installed JREs". _Not_ in eclipse.ini.
messages: + msg9953
messages: + msg9159