Title: java.nio.charset.UnsupportedCharsetException
Type: Severity: normal
Components: Any Versions: Jython 2.7
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: eaaltonen, jeff.allen, nullquery
Priority: Keywords:

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

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.

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:

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 (
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.
Date User Action Args
2015-04-24 14:18:27eaaltonensetnosy: + eaaltonen
messages: + msg9953
2014-10-17 20:08:48jeff.allensetnosy: + jeff.allen
messages: + msg9159
2014-10-15 18:44:47nullquerycreate