STINNER Victor added the comment:

'AB\xff'.encode('ascii') raises a UnicodeDecodeError because the byte string 
'AB\xff' is decoded from the default encoding (sys.getdefaultencoding(), which 
is 'ASCII' in most cases), before  the .encode() method is called.

This is not a Python bug, but it is surprising. You should try Python 3 which 
does not have implicit conversion from/to bytes/unicode.

----------
nosy: +haypo
resolution:  -> invalid
status: open -> closed

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue16456>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to