Paul - The Programmer

simple & stupid
find & insert new line with VIM
Configure javac to report messages in English

Fix the Jython console on my Windows XP

paul posted @ Sat, 30 Jan 2010 20:48:00 +0800 in coding life with tags Jython , 3325 readers

The Jython console didn't work properly on my Chinese version Windows XP. It can not interprete the strings properly.

e.g.

>>> print "hello world"

....

Looks like it's looking for a futher input.  After I input a '\n', ther console crashed and complains

LookupError: unknown encoding 'gb18030'.

This error never happens on the English version Windows XP. So, this problem definitely caused by the system default encoding.

 

With a few hours study for the JVM & the Jython encoding setting, I found 2 solutions.

1)  Change the JVM default character encoding

Start up the jython with option -Dfile.encoding=UTF8,then the Jython console's encoding will be UTF8 as well.

e.g.

jython -Dfile.encoding=UTF8


For change the JVM encoding automatically, you can also create one environment variable JAVA_TOOL_OPTIONS to -Dfile.encoding=UTF8.

e.g.

set JAVA_TOOL_OPTIONS="-Dfile.encoding=UTF8"

2) Change the Jython console character encoding

Start up the jython with option -Dpython.console.encoding=UTF8

e.g.

jython -Dpython.console.encoding=UTF8

Or add this setting in the Jython registry file. On my laptop, the file is C:\jython25\registry

 

Now, you enjoy.

 

 

 

Creative Commons License
This work is licensed under a Creative Commons Attribution 3.0 Unported License.
  • No match
  • No match

Login *


loading captcha image...
(type the code from the image)
or Ctrl+Enter