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 Wojtek.Szymilowski
Recipients Wojtek.Szymilowski, ezio.melotti
Date 2012-11-11.22:51:35
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1352674296.04.0.101357421426.issue16456@psf.upfronthosting.co.za>
In-reply-to
Content
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 recent call last):
  File "<pyshell#27>", line 1, in <module>
    'AB\xff'.encode('ascii')
UnicodeDecodeError: 'ascii' codec can't decode byte 0xff in position 2: ordinal not in range(128)

---- unicode string:
>>> u'AB\xff'.encode('ascii')

Traceback (most recent call last):
  File "<pyshell#28>", line 1, in <module>
    u'AB\xff'.encode('ascii')
UnicodeEncodeError: 'ascii' codec can't encode character u'\xff' in position 2: ordinal not in range(128)
History
Date User Action Args
2012-11-11 22:51:36Wojtek.Szymilowskisetrecipients: + Wojtek.Szymilowski, ezio.melotti
2012-11-11 22:51:36Wojtek.Szymilowskisetmessageid: <1352674296.04.0.101357421426.issue16456@psf.upfronthosting.co.za>
2012-11-11 22:51:35Wojtek.Szymilowskilinkissue16456 messages
2012-11-11 22:51:35Wojtek.Szymilowskicreate