Message5550

Author yanne
Recipients yanne
Date 2010-02-23.09:38:58
SpamBayes Score 3.7318713e-09
Marked as misclassified No
Message-id <1266917939.58.0.784631024042.issue1563@psf.upfronthosting.co.za>
In-reply-to
Content
jth@l228:~$ cat TestObj.java 
public class TestObj {
    public String toString() {
        return "Circle is 360\u00B0";
    }
}
jth@l228:~$ javac TestObj.java

jth@l228:~$ jython22 -c "import TestObj as T; print unicode(T())"
Circle is 360°
jth@l228:~$ jython25 -c "import TestObj as T; print unicode(T())"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
UnicodeDecodeError: 'ascii' codec can't decode byte 0xb0 in position 13: ordinal not in range(128)

I can get unicode working by first calling toString() of the object:

jth@l228:~$ jython25 -c "import TestObj as T; print unicode(T().toString())"
Circle is 360°

Should unicode() call toString() automatically also with 2.5?
History
Date User Action Args
2010-02-23 09:38:59yannesetrecipients: + yanne
2010-02-23 09:38:59yannesetmessageid: <1266917939.58.0.784631024042.issue1563@psf.upfronthosting.co.za>
2010-02-23 09:38:59yannelinkissue1563 messages
2010-02-23 09:38:58yannecreate