On 07/08/07, Guido van Rossum <[EMAIL PROTECTED]> wrote: > On 8/7/07, Thomas Heller <[EMAIL PROTECTED]> wrote: > > I wanted to look into this and noticed that 'import time' on Windows > > doesn't work anymore on my machine. The reason is that > > PyUnicode_FromStringAndSize() > > is called for the string 'Westeuropäische Normalzeit', and then fails with > > > > UnicodeDecodeError: 'utf8' codec can't decode bytes in position 9-11: > > invalid data > > I'm assuming that's a literal somewhere? In what encoding is it? That > function was recently changed to require the input to be UTF-8. If the > input isn't UTF-8, you'll have to use another API with an explicit > encoding, PyUnicode_Decode().
I'd guess it's coming from a call to a Windows API somewhere. The correct fix is probably to switch to using the "wide character" Windows APIs, which will give Unicode values as results directly. A shorter-term fix is possibly to use Windows' default code page to decode all strings coming back from Windows APIs (although I'm not sure it'll be any quicker in practice!). Paul. _______________________________________________ Python-3000 mailing list [email protected] http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com
