Unicode Windows API, Was: Concerns about using Python's ctypes library on Windows

Adrian Buehlmann adrian at cadifra.com
Sun Jul 31 09:46:23 CDT 2011


On 2011-07-31 15:30, Antoine Pitrou wrote:
> On Sun, 31 Jul 2011 11:19:15 +0200
> Adrian Buehlmann <adrian at cadifra.com> wrote:
>>
>> What I'm asking myself a bit is how efficient regarding speed it is to
>> convert forth and back from UTF-16 at such a low layer as the fixutf8
>> extension naturally has to do it.
> 
> First, you don't have to encode to UTF-16 explicitly. You can use
> unicode objects, since they are represented using 2-byte code points
> under Windows: the internal representation can be passed directly to
> the Windows "wide" APIs (that's what Python itself does, if e.g. you
> pass an unicode string to open()).

FWIW, we can't use Python's open() on Windows, see
http://mercurial.selenic.com/wiki/UnlinkingFilesOnWindows for why.


More information about the Mercurial-devel mailing list