Umlauts in idle

Marc 'BlackJack' Rintsch bj_666 at gmx.net
Sat Dec 13 06:35:24 EST 2008


On Sat, 13 Dec 2008 02:58:48 -0800, a_olme wrote:

> On 13 Dec, 10:38, "Martin v. Löwis" <mar... at v.loewis.de> wrote:
>> > When I try to use umlauts in idle it will only print out as Unicode
>> > escape characters. Is it possible to configure idle to print them as
>> > ordinary characters?
>>
>> Did you really use the print statement? They print out fine for me.
>>
>> Regards,
>> Martin
> 
> No I just put the characters in quotes like this "öäå"[::-1] and pressed
> return.

Then you have two problems:  First, you don't have unicode characters but 
a bunch of bytes which encode the three characters you've showed above.  
Reversing the bytes might "break" them if your system uses multiple bytes 
to encode one character, e.g. UTF-8, because the order does matter.

Second, if you don't ``print`` but let the interpreter show the result 
you get the `repr()` form of that character displayed, which always uses 
escapes for bytes that are non-printable or not within the ASCII range 
for strings.

Ciao,
	Marc 'BlackJack' Rintsch



More information about the Python-list mailing list