This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients Wojtek.Szymilowski, ezio.melotti, vstinner
Date 2012-11-11.23:57:40
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1352678260.94.0.804740030943.issue16456@psf.upfronthosting.co.za>
In-reply-to
Content
'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.
History
Date User Action Args
2012-11-11 23:57:40vstinnersetrecipients: + vstinner, ezio.melotti, Wojtek.Szymilowski
2012-11-11 23:57:40vstinnersetmessageid: <1352678260.94.0.804740030943.issue16456@psf.upfronthosting.co.za>
2012-11-11 23:57:40vstinnerlinkissue16456 messages
2012-11-11 23:57:40vstinnercreate