Using more than 7 bit ASCII on windows.

Mark Hammond MarkH at ActiveState.com
Sun Oct 29 17:15:47 EST 2000


Paul Moore wrote:

> Yes, the whole setup for non-ASCII characters seems to be very odd, if
> not broken.

It is :-(  I will fix it.  If the code works in Python.exe (as yours 
appears to) it should work in Pythonwin.exe.

> Looks like the net result is that Latin-1 and the like are now
> as hard as the multi-byte character sets, rather than making the
> multi-byte stuff as easy as Latin-1.

Don't forget that Latin-1 is not Unicode.  Python has chosen not to have 
a default character set.

So you are correct, that the "accidental" behaviour of Python strings 
with characters > 127 were often "useful" as they used the current code 
page.  with Unicode, such accidents can't happen - you must be explicit.

> Someone please tell me I'm wrong, and explain how I should have done
> this. You'll need to convince me that the fact that
> 
>     >>> os.chdir('10£')
> 
> doesn't work is not a bug, first...

I doubt you are able to be convinced, but it is a feature.  The string 
you reference has no meaning without knowledge of the character set. 
Asian speakers would be happy to tell you why an assumption of "Latin-1" 
for the default character set is not always appropriate.

That said, I still agree Pythonwin should behave the same as Python.exe 
- but _neither_ of them will allow your chdir() to work (but both 
_should_ correctly display the string)

Mark.




More information about the Python-list mailing list