[issue16456] UnicodeDecodeError thrown for 'encode' operation on string

2012-11-17 Thread Ezio Melotti
Changes by Ezio Melotti : -- stage: -> committed/rejected ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http

[issue16456] UnicodeDecodeError thrown for 'encode' operation on string

2012-11-11 Thread STINNER Victor
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 s

[issue16456] UnicodeDecodeError thrown for 'encode' operation on string

2012-11-11 Thread Wojtek Szymilowski
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