i18n: looking for expertise

"Martin v. Löwis" martin at v.loewis.de
Fri Mar 11 11:12:05 CET 2005


klappnase wrote:
> Oh, from the reading docs I had thought XP would use unicode:

It depends on the API that the application uses. Windows has the
"ANSI" (*) API (e.g. CreateFileExA) and the "Unicode" API
(CreateFileExW). The ANSI API uses what Python calls the "mbcs"
encoding; Windows calls it the ANSI code page (CP_ANSI). The
Unicode API expects WCHAR pointers.

Python uses the *W APIs since Python 2.3 (I believe), except that
maybe os.access was overlooked in 2.3 as well, so it uses the *W
API for access only in 2.4. At run-time, it dynamically decides
which API to use, and uses *W on NT+ (i.e. NT, W2k, WXP, W2k3, ...).

> * On Windows 9x, the encoding is ``mbcs''. 

Correct.

> * On Mac OS X, the encoding is ``utf-8''. 

Correct.

> * On Unix, the encoding is the user's preference according to the
> result of nl_langinfo(CODESET), or None if the nl_langinfo(CODESET)
> failed.

Correct. In the latter case, it falls back to sys.getdefaultencoding().

> When on windows the filesystemencoding differs from what I get in
> UnicodeHandler.sysencoding

That could happen on OS X.

> Tk seems to be pretty smart on handling unicode, so using unicode for
> everything that's displayed on tk widgets should be ok (I hope).

So do I.

Regards,
Martin



More information about the Python-list mailing list