Japanese codecs (was Re: [Python-Dev] PEP 263 -- Python Source Code Encoding)

Martin v. Loewis martin@v.loewis.de
28 Feb 2002 22:51:46 +0100

"M.-A. Lemburg" <mal@lemburg.com> writes:

> Which wrapper APIs do we currently have which could actually
> be made part of the Python core ?

On Unix, we have iconv(3). On Windows, we have MultiByteToWideChar,
which would need to be wrapped with a map translating codec names to
codepage numbers. There is also a codec API through a COM interface
provided by Internet Exploder; I don't have the name of that interface
right now.

On all platforms, we could easily wrap the Tcl encodings, which are
available everywhere where Python is available. Not sure what the
performance implications would be.

There also could be a wrapper around ICU.

On OS X, CFStringCreateFromExternalRepresentation could be used.

> Aside: while it's true that we could use those, the Unicode 
> implementation has shown that rolling our own has worked out
> quite well too.

There have been a few correctness glitches in those, but overall, I'd
agree that they have worked quite well. Performance is a different
issue, though; people just haven't complained, yet, IMO.