[Python-Dev] Removal of Win32 ANSI API
"Martin v. Löwis"
martin at v.loewis.de
Fri Nov 26 21:39:36 CET 2010
> Is it possible a conversion from bytes (ANSI) to unicode fails on
> windows?
It should fail sometimes, right? Not for windows-1252, but certainly
for shift-jis (you know better than me). It seems that whether
MultiByteToWideChar will fail depends on whether MB_ERR_INVALID_CHARS
is given or not. I don't know what it will do if this flag is not
given - my guess it fills in REPLACEMENT CHARACTER.
> If not, is it allowed to convert to unicode with
> PyUnicode_FSDecoder if function doesn't return str? For example,
> os.stat() takes str as arguments but doesn't return str.
This I don't understand. os.stat doesn't return text at all -
so what do you want to convert?
> # I noticed win_readlink() in Modules/posixmodule.c already unicode
> # only. Maybe not so much problem? ;-)
Well, readlink is new on Windows, and symlinks are not widespread.
So there is no backwards compatibility concern here.
Regards,
Martin
More information about the Python-Dev
mailing list