To decode a byte sequence from latin 1 to Unicode, use the .decode()
method:
>>> '\xe9'.decode('latin1')
u'\xe9'
Python uses \xab
escapes for unicode codepoints below \u00ff
.
>>> '\xe9'.decode('latin1') == u'\u00e9'
True
The above Latin-1 character can be encoded to UTF-8 as:
>>> '\xe9'.decode('latin1').encode('utf8')
'\xc3\xa9'