[issue3727] poplib module broken by str to unicode conversion
STINNER Victor
report at bugs.python.org
Mon Oct 13 23:57:45 CEST 2008
STINNER Victor <victor.stinner at haypocalc.com> added the comment:
Here is a patch proposition:
- a socket uses bytes
- makefile() creates an unicode file using 'r' mode
- default encoding ISO-8859-1 because I guess that most servers use
this encoding, but you can change the encoding using "encoding"
constructor optioan argument
- read unicode and write unicode: convert convert from/to bytes at
the last moment (just after/before reading/writing the socket)
- cosmetic: use .startswith() instead of for example b[:2] == '..'
Test updates:
- replace "localhost" by HOST
- write a test for a logging (user + password)
Missing: no SSL unit test. I tested SSL on my personal POP3 account,
but only the login.
----------
keywords: +patch
nosy: +haypo
Added file: http://bugs.python.org/file11775/poplib_unicode.patch
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue3727>
_______________________________________
More information about the Python-bugs-list
mailing list