Characters in Python

Jan Sundström jansun at home.se
Thu Jun 5 08:23:46 EDT 2003


This is a newbie question, but...

I just downloaded Pyton 2.2.2 for Windows and started exploring it.
I installed it so I can use TextPad or IDLE 0.8 with it and all ran
just fine, until I started to write strings with scandinavian
characters in them.

   >>> str = 'åäö'
   UnicodeError: ASCII encoding error: ordinal not in range(128)

It works fine in a DOS console window or run from TextPad if I do
something like

   str = 'Åäö'
   print str


Python, or perhaps IDLE rather, doesn't seem toaccept characters with 
codes over 127. 
Is there a simple way to turn off this obscession with 7-bit ASCII?

And how can one easily change what Python considers to be
default character encoding? 
I couldn't find anything about that in the tutorial.




More information about the Python-list mailing list