Author amak
Recipients amak, amylin
Date 2008-11-26.12:55:48
SpamBayes Score 9.29351e-06
Marked as misclassified No
Message-id <>
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))

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).

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:50amaksetmessageid: <>
2008-11-26 12:55:50amaksetrecipients: + amak, amylin
2008-11-26 12:55:50amaklinkissue1163 messages
2008-11-26 12:55:49amakcreate