In python, if giving 0x90
(or \x90
), how to encode it into a string as macOS Roman Encoding to \xc3\xaa
, aka ê
?
I tried bytes('\x90').encode('mac-roman')
, it just throw errors.
chr(0x90).encode('mac-roman')
is still the same failure.
Please help, thanks!
It depends on what you final goal is, but as such it is encoded, so you first need to decode it, i mean, e.g.
You were almost there.
Actually, after searching two web pages: http://unicode.org/Public/MAPPINGS/VENDORS/APPLE/ROMAN.TXT it shows:
and http://www.fileformat.info/info/unicode/char/ea/index.htm,:
and trying decoding/encoding, I found it's:
'\x90'.decode('mac-roman').encode('utf-8')