[issue5905] strptime fails in non-UTF locale
Marc-Andre Lemburg
report at bugs.python.org
Fri Jan 15 13:57:23 CET 2010
Marc-Andre Lemburg <mal at egenix.com> added the comment:
The reason for this is that the strftime() C lib API is used to build localized month names. With your setting, you'll get French Latin-1 month names and those cannot be coerced to UTF-8 due to the accented characters in them.
This works in Python 2.x since PyUnicode_FromString() et al. convert Latin-1 strings to Unicode.
Apparently, this was changed in Python 3.x without looking at the header file or looking at the Python 2.x implementation which mandate Latin-1 as input encoding. Even the Python 3.x header still says that PyUnicode_FromString() will convert from Latin-1 to Unicode.
No idea why time.strptime() even bothers with these month names, though, since neither the format string nor the string being parsed contains literal month names.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue5905>
_______________________________________
More information about the Python-bugs-list
mailing list