Message5550
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? |
|
Date |
User |
Action |
Args |
2010-02-23 09:38:59 | yanne | set | recipients:
+ yanne |
2010-02-23 09:38:59 | yanne | set | messageid: <1266917939.58.0.784631024042.issue1563@psf.upfronthosting.co.za> |
2010-02-23 09:38:59 | yanne | link | issue1563 messages |
2010-02-23 09:38:58 | yanne | create | |
|