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 terry.reedy
Recipients ezio.melotti, pradyunsg, terry.reedy
Date 2013-03-09.02:25:07
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1362795907.55.0.317231526287.issue17348@psf.upfronthosting.co.za>
In-reply-to
Content
I do not see any bug. Unicode chars do not have an encoding (except internally) The .encode() method encodes the the unicode string to a byte string. It does *not* mutate the string. Since you do not bind the byte string to anything, it disappears. Compare

>>> c = u'\u20ac'
>>> b = c.encode()
>>> c
'€'
>>> b
b'\xe2\x82\xac'

Now you have both the unicode string and the utf-8 encoded byte string that represents the char.

>>> b.decode()
'€'

If you have any more questions, please reread the tutorial or ask on python-list or even the tutor list. Also post there about any 'problems' you find.
History
Date User Action Args
2013-03-09 02:25:07terry.reedysetrecipients: + terry.reedy, ezio.melotti, pradyunsg
2013-03-09 02:25:07terry.reedysetmessageid: <1362795907.55.0.317231526287.issue17348@psf.upfronthosting.co.za>
2013-03-09 02:25:07terry.reedylinkissue17348 messages
2013-03-09 02:25:07terry.reedycreate