[Python-3000] Pleaswe help with the countdown to zero failing tests in the struni branch!

Paul Moore p.f.moore at gmail.com
Tue Aug 7 17:02:40 CEST 2007


On 07/08/07, Guido van Rossum <guido at python.org> wrote:
> On 8/7/07, Thomas Heller <theller at ctypes.org> 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.


More information about the Python-3000 mailing list