Τη Κυριακή, 9 Ιουνίου 2013 12:20:58 μ.μ. UTC+3, ο χρήστης Lele Gaifax έγραψε:
> > How about a string i wonder?
> > s = "νίκος"
> > what_are these_bytes = s.encode('iso-8869-7').encode(utf-8')
> Ignoring the usual syntax error, this is just a variant of the code I
> posted: "s.encode('iso-8869-7')" produces a bytes instance which
> *cannot* be "re-encoded" again in whatever encoding.
s = 'a'
s = s.encode('iso-8859-7').decode('utf-8')
print( s )
a (we got the original character back)
================================
s = 'α'
s = s.encode('iso-8859-7').decode('utf-8')
print( s )
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe1 in position 0:
unexpected end of data
Why this error? because 'a' ordinal value > 127 ?
--
http://mail.python.org/mailman/listinfo/python-list