Changes by Ezio Melotti ezio.melo...@gmail.com:
--
stage: - committed/rejected
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16456
___
___
New submission from Wojtek Szymilowski:
UnicodeDecodeError exception is reported for encode operation on strings.
This issue does not surface for the same operation on unicode string
(UnicodeEncodeError exception is correctly reported).
string:
'AB\xff'.encode('ascii')
Traceback (most
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