Terry J. Reedy added the comment:

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.

----------
components: +Unicode -IDLE
nosy: +ezio.melotti, terry.reedy
resolution:  -> invalid
stage:  -> committed/rejected
status: open -> closed

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue17348>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to