Issue2128

classification
Title: PyObjectDerived __str__cant support unicode
Type: Severity: normal
Components: Core Versions: Jython 2.7
Milestone:
process
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: Nosy List: liucong0311, zyasoft
Priority: Keywords:

Created on 2014-04-22.15:00:02 by liucong0311, last changed 2014-07-01.04:04:56 by zyasoft.

Messages
msg8296 (view) Author: LiuCong (liucong0311) Date: 2014-04-22.15:04:01
java code
class A{

String toString() {
return "哈"
}
}
jython code:(I use PythonInterpreter)
a=A()
print a


when print a java Object, jython cant support unicode, I think this is a bug 
PyJavaType code(__repr__ print a string,but this encode by local charset):

addMethod(new PyBuiltinMethodNarrow("__repr__") {
                @Override
                public PyObject __call__() {
                    String toString = self.getJavaProxy().toString();
                    return toString == null ? Py.EmptyString : Py.newString(toString);
                }
            });
msg8692 (view) Author: Jim Baker (zyasoft) Date: 2014-06-19.00:42:29
This doesn't really make sense, __str__ is supposed to return a str. Use __unicode__ to return a unicode string.
History
Date User Action Args
2014-07-01 04:04:56zyasoftsetstatus: pending -> closed
2014-06-23 18:08:14zyasoftsetstatus: open -> pending
resolution: wont fix
2014-06-19 00:42:29zyasoftsetmessages: + msg8692
2014-05-21 23:05:35zyasoftsetnosy: + zyasoft
2014-04-22 15:04:01liucong0311setmessages: + msg8296
2014-04-22 15:00:02liucong0311create