STINNER Victor <[EMAIL PROTECTED]> added the comment:

The server can send raw 8 bits email in any charset (charset is 
specified in the email headers). That's why I think that it's better 
to keep bytes instead of the unicode conversion using a fixed charset. 
Each email can use a different charset.

Types used in my new patch:
 - unicode:
   * IMAP commands (charset=ASCII)
   * untagged_responses keys (charset=ASCII)
 - bytes:
   * answer
   * regex
   * tagre attribute
   * untagged_responses values

I chooosed to keep unicode for some variables to minimize the changes 
in imaplib library and to keep readable code.

Patch TODO:
 - Remove the assert (added for quicker debugging)
 - Test more functions
 - Restore _checkquote() in _command() method or use 
_quote()/_checkquote() in method which need it. login() already quote 
the password (but why not the login?)

I also wrote a patch for a "pure bytes string" version, but the patch 
is complex, long and the resulting module source code is hard to read.

Added file: http://bugs.python.org/file11794/imaplib_bytes.patch

_______________________________________
Python tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1210>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to