Message3853
This is not a bug.
When you ask for a string object to dumped on the console, you get the
repr of the string, which in this case is the correct: 'ceci a \xE9t\xE9
fait d\xE9j\xE0'
Python repr (see repr(object))
http://www.python.org/doc/2.5.2/lib/built-in-funcs.html
Note that all of those character codes are correct, according to the
ISO-8859-1 character encoding (which is presumably the encoding of your
original java source file).
http://en.wikipedia.org/wiki/ISO_8859-1
You get the correct representation when you print because jython sends
the actual bytes (not the repr) to the terminal, and your terminal
understands them (presumably because it is a ISO-8859-1) aware terminal.
If that was a windows terminal you were working on, you would have to
encode as something like "cp850" to get the correct display of glyphs on
your terminal; i.e. you would have to do:>>> print s.encode("cp850")
Python repr exists to render a *printable* representation that will
display the actual content of the string, regardless of the character
encoding of the terminal you print it to.
I recommend that we close this is "not a bug". |
|
Date |
User |
Action |
Args |
2008-11-26 12:55:50 | amak | set | messageid: <1227704150.28.0.183261936283.issue1163@psf.upfronthosting.co.za> |
2008-11-26 12:55:50 | amak | set | recipients:
+ amak, amylin |
2008-11-26 12:55:50 | amak | link | issue1163 messages |
2008-11-26 12:55:49 | amak | create | |
|