[New-bugs-announce] [issue11024] imaplib: Time2Internaldate() returns localized strings

Sebastian Spaeth report at bugs.python.org
Thu Jan 27 14:35:01 CET 2011


New submission from Sebastian Spaeth <sebastian at sspaeth.de>:

imaplib's Time2Internaldate returns invalid (as localized) INTERNALDATE strings. Appending a message with such a time string leads to a:
19 BAD Command Argument Error. 11 (for MS Exchange IMAP servers)

it returned "26-led-2011 18:23:44 +0100", however:

http://tools.ietf.org/html/rfc2060.html defines:
date_month      ::= "Jan" / "Feb" / "Mar" / "Apr" / "May" / "Jun" /
                    "Jul" / "Aug" / "Sep" / "Oct" / "Nov" / "Dec"

so it expects an English date format.

imaplib's Time2Internaldate uses time.strftime() to create the final string which uses the current locale, returning things such as:

"26-led-2011 18:23:44 +0100" rather than "26-Jan-2011 18:23:44 +0100".

For the right thing to do, we would need to set locale.setlocale(locale.LC_TIME, '') to get English formatting or we would need to use some home-grown parser that hardcodes the proper terms.

----------
components: Library (Lib)
messages: 127186
nosy: spaetz
priority: normal
severity: normal
status: open
title: imaplib: Time2Internaldate() returns localized strings
type: behavior
versions: Python 2.6

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue11024>
_______________________________________


More information about the New-bugs-announce mailing list