Windows XP unicode and escape sequences

Ross Ridge rridge at caffeine.csclub.uwaterloo.ca
Sun Dec 16 21:59:27 EST 2007


<jyoung79 at kc.rr.com> wrote:
>This brings up another question.  If I run some Python code that starts
>off with 'os.system('cp869')' so it will change to the correct code page,
>then when it starts printing the Greek characters it breaks.  But run
>the same Python code again and it works fine.

That's probably because the encoding of stdin, stdout, and stderr is set
according to the code page of the console they're connected to (if any)
when Python starts.

>Is there another way to do this so I can change over to the 869 code
>page and continue on with the Greek letters printing correctly?

Unfortunately, you can't easily change the encoding of file object after
it's been created.  It's probably simpler convert Unicode strings to cp869
before printing them instead of having Python do it automatically for you.

					Ross Ridge

-- 
 l/  //	  Ross Ridge -- The Great HTMU
[oo][oo]  rridge at csclub.uwaterloo.ca
-()-/()/  http://www.csclub.uwaterloo.ca/~rridge/ 
 db  //	  



More information about the Python-list mailing list