New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
imaplib should support international mailbox names #49555
Comments
The IMAP4rev1 specification allows for non-ASCII mailbox names using a It would be useful if Python provided an encoder/decoder for the |
Can you provide a patch? |
I'll have a go at implementing the algorithm. It looks like the Would String2Mailbox and Mailbox2String utility functions be appropriate |
IMAP4 UTF-7 is implemented in Twisted - |
I don't have a good understanding of imaplib; if you think it's |
UTF-7 already sounds like something horrible for me, but a *modified* (sorry, it's an off topic dummy question) |
UTF-7 wasn't horrible for its time, but its time has very likely passed. As for why IMAP4 uses a modified form of UTF-7, the RFC addresses this: The purpose of these modifications is to correct the following
Whether you are convinced by these arguments or not is, of course, By convention, international mailbox names in IMAP4rev1 are specified However, it seems stupid to say that the choice if encoding is only a |
twisted's code does not work good for "\t", "\r", "\n", those characters must encoded in modified base64 form according to RFC 3501. |
So noone is working on this issue ATM? |
There's a working implementation of this in PloneMailList. |
I've used the PloneMailList implementation in another project. It works well to add 'imap4-utf-7' as codec. The twisted imap implementation seems to have been updated to properly support non-printable ASCII, but the twisted imap API is problematic for imaplib because twisted seems to expect its arguments to already be Python unicode. So can we be specific about what kind of API change would satisfy this issue:
|
Being bitten by this today. |
Point 2 of cfraire message is a big issue. What about leaving this problem to the library user simply providing two helper functions in the module to encode/decode mUTF-7?. |
Or a new encoder/decoder in "codecs" module. |
Could you elaborate on this? As far as I can tell, it works fine: >>> import twisted.mail.imap4
>>> print u"Hello, \N{SNOWMAN}".encode('imap4-utf-7')
Hello, &JgM-
>>> print b'Hello, &JgM-'.decode('imap4-utf-7')
Hello, ☃
>>> What would you expect to work differently? |
twisted imap4-utf-7 seems to be improved in this 2 years. :-) |
First step is to provide mUTF-7 in Python 3.5. Then we can try to update imaplib. I am specially worried about the points cfraire raises in http://bugs.python.org/issue5305#msg151859. Lets see. |
I wasn't addressing encode/decode specifically. Both twisted and PloneMailList offer implementations with same encoding name, "imap4-utf-7". I meant that it's difficult for the twisted API to inform what might be done for imaplib since twisted takes full unicode but imaplib expects only unicode-ASCII subset. The first part of jamesh's original issue is just encoder/decoder, so either twisted or PloneMailList would seem to suffice. I was addressing jamesh's second part whether "optionally if imaplib would perform the encoding and decoding at the appropriate points." Point 2 of my response seems the more difficult. imaplib list and lsub return str instances with ASCII + utf-7 stuffed together. (twisted avoids this by returning tuples of unicode, if I understand correctly). |
Ping. |
ssu |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: