From: <pj...@us...> - 2009-05-10 02:14:28
|
Revision: 6322 http://jython.svn.sourceforge.net/jython/?rev=6322&view=rev Author: pjenvey Date: 2009-05-10 01:34:53 +0000 (Sun, 10 May 2009) Log Message: ----------- drive encoding from python.console.encoding falling back to file.encoding Modified Paths: -------------- trunk/jython/src/org/python/core/PySystemState.java trunk/jython/src/org/python/util/jython.java Modified: trunk/jython/src/org/python/core/PySystemState.java =================================================================== --- trunk/jython/src/org/python/core/PySystemState.java 2009-05-10 00:00:52 UTC (rev 6321) +++ trunk/jython/src/org/python/core/PySystemState.java 2009-05-10 01:34:53 UTC (rev 6322) @@ -36,6 +36,7 @@ { public static final String PYTHON_CACHEDIR = "python.cachedir"; public static final String PYTHON_CACHEDIR_SKIP = "python.cachedir.skip"; + public static final String PYTHON_CONSOLE_ENCODING = "python.console.encoding"; protected static final String CACHEDIR_DEFAULT_NAME = "cachedir"; public static final String JYTHON_JAR = "jython.jar"; @@ -216,12 +217,7 @@ } private void initEncoding() { - String encoding; - try { - encoding = System.getProperty("file.encoding"); - } catch (SecurityException se) { - encoding = null; - } + String encoding = registry.getProperty("python.console.encoding"); if (encoding == null) { return; } @@ -631,6 +627,15 @@ registry.put(PYTHON_CACHEDIR_SKIP, "true"); } } + if (!registry.containsKey(PYTHON_CONSOLE_ENCODING)) { + String encoding; + try { + encoding = System.getProperty("file.encoding"); + } catch (SecurityException se) { + encoding = null; + } + registry.put(PYTHON_CONSOLE_ENCODING, encoding); + } // Set up options from registry Options.setFromRegistry(); } Modified: trunk/jython/src/org/python/util/jython.java =================================================================== --- trunk/jython/src/org/python/util/jython.java 2009-05-10 00:00:52 UTC (rev 6321) +++ trunk/jython/src/org/python/util/jython.java 2009-05-10 01:34:53 UTC (rev 6322) @@ -280,8 +280,7 @@ if (opts.fixInteractive || (opts.filename == null && opts.command == null)) { if (opts.encoding == null) { - opts.encoding = PySystemState.registry.getProperty( - "python.console.encoding", null); + opts.encoding = PySystemState.registry.getProperty("python.console.encoding"); } if (opts.encoding != null) { if (!Charset.isSupported(opts.encoding)) { @@ -422,6 +421,7 @@ warnoptions.add(args[++index]); } else if (arg.equals("-C")) { encoding = args[++index]; + setProperty("python.console.encoding", encoding); } else if (arg.equals("-E")) { // XXX: accept -E (ignore environment variables) to be compatiable with // CPython. do nothing for now (we could ignore the registry) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |