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 Sworddragon
Recipients Sworddragon, ezio.melotti, vstinner
Date 2014-04-22.20:58:23
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1398200303.74.0.876201125787.issue21331@psf.upfronthosting.co.za>
In-reply-to
Content
I have made some tests with encoding/decoding in conjunction with unicode-escape and got some strange results:

>>> print('ä')
ä
>>> print('ä'.encode('utf-8'))
b'\xc3\xa4'
>>> print('ä'.encode('utf-8').decode('unicode-escape'))
ä
>>> print('ä'.encode('utf-8').decode('unicode-escape').encode('unicode-escape'))
b'\\xc3\\xa4'
>>> print('ä'.encode('utf-8').decode('unicode-escape').encode('unicode-escape').decode('utf-8'))
\xc3\xa4


Shouldn't .decode('unicode-escape').encode('unicode-escape') nullify itself and so "'ä'.encode('utf-8').decode('unicode-escape').encode('unicode-escape')" return the same result as 'ä'.encode('utf-8')?
History
Date User Action Args
2014-04-22 20:58:23Sworddragonsetrecipients: + Sworddragon, vstinner, ezio.melotti
2014-04-22 20:58:23Sworddragonsetmessageid: <1398200303.74.0.876201125787.issue21331@psf.upfronthosting.co.za>
2014-04-22 20:58:23Sworddragonlinkissue21331 messages
2014-04-22 20:58:23Sworddragoncreate