Python如何将0x90(\x90)编码为macOS Roman编码为\xc3\xaa [英] Python how to encode 0x90(\x90) as macOS Roman Encoding to \xc3\xaa

查看:268
本文介绍了Python如何将0x90(\x90)编码为macOS Roman编码为\xc3\xaa的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在python中,如果给出 0x90 (或 \x90 ),则如何将其编码为字符串macOS Roman编码为 \xc3\xaa ,又称为ê

In python, if giving 0x90(or \x90), how to encode it into a string as macOS Roman Encoding to \xc3\xaa, aka ê?

我尝试了 bytes('\x90')。encode('mac-roman'),它只是抛出错误。

I tried bytes('\x90').encode('mac-roman'), it just throw errors.

chr(0x90).encode('mac-roman')仍然是相同的失败。

请帮助,谢谢!

推荐答案

实际上,在搜索了两个网页之后:
http://unicode.org/Public/MAPPINGS/VENDORS/APPLE/ROMAN.TXT
它显示:

Actually, after searching two web pages: http://unicode.org/Public/MAPPINGS/VENDORS/APPLE/ROMAN.TXT it shows:


0x90 0x00EA#带圆弧的拉丁文小写字母

0x90 0x00EA # LATIN SMALL LETTER E WITH CIRCUMFLEX

http: //www.fileformat.info/info/unicode/char/ea/index.htm ,:


UTF-8 (十六进制) 0xC3 0xAA(c3aa)

UTF-8 (hex) 0xC3 0xAA (c3aa)

UTF-8(二进制)11000011:10101010

UTF-8 (binary) 11000011:10101010

UTF-16(十六进制) 0x00EA(00ea)

UTF-16 (hex) 0x00EA (00ea)

并尝试解码/编码,我发现它是:

and trying decoding/encoding, I found it's:

'\x90'.decode('mac-roman')。encode('utf-8')

这篇关于Python如何将0x90(\x90)编码为macOS Roman编码为\xc3\xaa的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆