Windows XP unicode and escape sequences

MonkeeSage MonkeeSage at gmail.com
Sun Dec 16 19:09:07 EST 2007


On Dec 16, 5:28 pm, <jyoun... at kc.rr.com> wrote:
> Thank you John and Tim.
>
> With your help I found that the XP console code page is set up for 'cp437' and with a little bit of browsing I found that 869 is the code page for Modern Greek.  After changing it to 869 that did the trick!  Thanks very much for this advice.
>
> 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.  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?
>
> Thanks Tim for the info about the CONFIG.NT file as well as the curses-like info.  I'll continue to research these.
>
> Thanks again!
>
> Jay
>
> > CONFIG.NT only affects 16-bit programs running in the NTVDM (the Virtual
> > DOS Machine).
> > 32-bit console apps (which Python is) simply cannot use ANSI escape
> > sequences.  You have to use the Win32 APIs to do color.  There are
> > curses-like libraries available for Python.  Or:
> >http://www.effbot.org/zone/console-handbook.htm
> > --
> > Tim Roberts, timr at probo.com
> > Providenza & Boekelheide, Inc.

Try using the unicode switch ( cmd.exe /u ), rather than trying to set
the codepage. See here:
http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/cmd.mspx?mfr=true

Regards,
Jordan



More information about the Python-list mailing list