Locale-sensitive list separator under Windows

Adam Twardoch list.adam at twardoch.com
Wed Jan 15 22:58:40 EST 2003


"Adam Twardoch" <list.adam at twardoch.com> wrote in message
news:b052sg$lrq2f$1 at ID-135222.news.dfncis.de...

After some experiments, I found the solution -- below.
Adam

--

#Uses edll from http://pages.ccapcable.com/lac/extra/edll.py
#And calldll from http://www.nightmare.com/~rushing/dynwin/
from edll import Cfunc, Bptr
GetLocaleInfoW = Cfunc('kernel32','GetLocaleInfoW')
LocInfIn = "\x00"*255
LocInfOut = GetLocaleInfoW(1024, 12, Bptr(LocInfIn), len(LocInfIn))
uLocInfStr = LocInfOut[1].decode("utf_16_le")
ulistsep = uLocInfStr[:uLocInfStr.find("\x00")]
listsep = ulistsep.encode("unicode-escape", "replace")
print listsep





More information about the Python-list mailing list