[issue5562] Locale-based date formatting crashes on non-ASCII data

2009-05-29 Thread Martin v . Löwis
Martin v. Löwis added the comment: This is a duplicate of issue 3061. -- resolution: -> duplicate status: open -> closed superseder: -> time.strftime() always decodes result with UTF-8 ___ Python tracker

[issue5562] Locale-based date formatting crashes on non-ASCII data

2009-03-25 Thread Martin v. Löwis
Martin v. Löwis added the comment: I think the problem is that creation of the Unicode string defaults to UTF-8. It should instead use the locale's encoding. You are right that it could be an issue that there is no Python codec for the locale's encoding. To be robust against this case, I thin

[issue5562] Locale-based date formatting crashes on non-ASCII data

2009-03-25 Thread Antoine Pitrou
Antoine Pitrou added the comment: (if I explicitly set another encoding, it doesn't work however: >>> locale.setlocale(locale.LC_TIME, "fr_FR.ISO-8859-1") 'fr_FR.ISO-8859-1' >>> time.strftime("%B", (2009,2,1,0,0,0,0,0,0)) Traceback (most recent call last): File "", line 1, in UnicodeDecodeEr

[issue5562] Locale-based date formatting crashes on non-ASCII data

2009-03-25 Thread Antoine Pitrou
New submission from Antoine Pitrou : Locale-based date formatting in py3k (using strftime) crashes when asked to format a month name (or day, I assume) containing non-ASCII characters: >>> import time >>> import locale >>> time.strftime("%B", (2009,2,1,0,0,0,0,0,0)) 'February' >>> locale.setloca