From: <cg...@us...> - 2007-06-18 06:27:51
|
Revision: 3257 http://svn.sourceforge.net/jython/?rev=3257&view=rev Author: cgroves Date: 2007-06-17 23:27:49 -0700 (Sun, 17 Jun 2007) Log Message: ----------- specify iso-8859-1 to turn the byte array into a string rather than relying on the system default encoding. My mac uses something other than that as its default which causes the eight bit safe test from Alan's new socket stuff to fail Modified Paths: -------------- trunk/jython/src/org/python/core/PyArray.java Modified: trunk/jython/src/org/python/core/PyArray.java =================================================================== --- trunk/jython/src/org/python/core/PyArray.java 2007-06-18 06:17:10 UTC (rev 3256) +++ trunk/jython/src/org/python/core/PyArray.java 2007-06-18 06:27:49 UTC (rev 3257) @@ -9,6 +9,7 @@ import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; +import java.io.UnsupportedEncodingException; import java.lang.reflect.Array; /** @@ -20,7 +21,6 @@ * See also the jarray module. */ public class PyArray extends PySequence implements Cloneable { - //~ BEGIN GENERATED REGION -- DO NOT EDIT SEE gexpose.py /* type info */ @@ -1806,6 +1806,12 @@ } catch(IOException e) { throw Py.IOError(e); } - return new String(bos.toByteArray()); + try { + // The returned string is used as a Python str with values + // from 0-255. iso-8859-1 maps the byte values into that range. + return new String(bos.toByteArray(), "iso-8859-1"); + } catch (UnsupportedEncodingException e) { + throw Py.JavaError(e); + } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |