Using more than 7 bit ASCII on windows.

Syver Enstad syver.enstad at sensewave.com
Wed Nov 1 19:14:05 EST 2000


"Mark Hammond" <MarkH at ActiveState.com> wrote in message
news:39FCB40B.6090509 at ActiveState.com...
> Syver Enstad wrote:

> Please try applying this, and let me know if it works.  If I use the
> Windows "Character Map" application to paste an extended character, this
> is the behaviour I now see:
>

Yes, it works marvelously! Hurrah, great, fine!

By the way I am using ISO Latin1 as far as I know, and of course PythonWin.
Under python.exe all bets are off because I am using code page 850 there
which has other eight bit encoding for the same characters. Microsoft seems
to manage in some strange way with their cmd.exe as it shows the correct
directory names, but no other console based win32 programs I've seen (or
made myself) manages to do the same. I guess they call OemToAnsi and
AnsiToOem (or whatever their names are) on input/output respectively.

Here's an example of the new behaviour:

>>> import os
>>> os.getcwd()
'E:\\V\345re dokumenter'
>>> os.chdir('..')
>>> os.getcwd()
'E:\\'
>>> os.chdir('våre dokumenter')
>>> os.getcwd()
'E:\\v\345re dokumenter'
>>> os.chdir('e:/v\345re dokumenter')
>>> os.getcwd()
'e:\\v\345re dokumenter'
>>> os.chdir('c:/')
>>> os.getcwd()
'c:\\'
>>> os.chdir('e:/v\345re dokumenter')
>>> os.getcwd()
'e:\\v\345re dokumenter'
>>> print os.getcwd()
e:\våre dokumenter





More information about the Python-list mailing list