使用utf-9对文本进行编码和解码。
utf9的Python项目详细描述
说明
2005年4月1日,ieee发布了RFC4042“utf-9和utf-18 Unicode的高效转换格式:
The current representation formats for Unicode (UTF-7, UTF-8, UTF-16) are not storage and computation efficient on platforms that utilize the 9 bit nonet as a natural storage unit instead of the 8 bit octet.
因为使用9位非节点的体系结构并不多 自然存储单元并且发布日期是在愚人节 beautifulutf-9被遗忘,没有python实现 可用。
这个python模块就是为了填补这个空白!;)
用法
只有两个功能:
- utf9encode(string):接受一个字符串并返回一个utf9编码的 版本。
- utf9decode(data):接受utf9编码的数据并返回 对应的字符串。
示例
>>> import utf9 >>> encoded = utf9.utf9encode(u'ႹЄLᒪo, ?ǃ') >>> print repr(encoded) 'p\xe0\xb7-\x0c!1\xc3\x92\xd5\x1b\xc5\x82\x07n\x83x\xed\xdecX\xf80' >>> print utf9.utf9decode(encoded) ႹЄLᒪo, ?ǃ