【问题标题】:How to decode this wierd encoding in python?如何在 python 中解码这种奇怪的编码?
【发布时间】:2018-12-29 22:13:02
【问题描述】:

我正在使用移动运营商 API。当我收到波斯语的消息时,它会返回这样一个奇怪的编码。

062a0633062a

这个字符串在波斯语中代表تست。我知道每四个字符是波斯字符的 Unicode 表示。

如何解码这种编码?

【问题讨论】:

    标签: python django string python-3.x decode


    【解决方案1】:
    >>> binascii.unhexlify('062a0633062a').decode('utf-16be')
    'تست'
    

    【讨论】:

    • 感谢您的正常工作。但另一个问题是如何检测字符串是英文还是这种字符串?
    • 整篇论文都是关于这个的。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-08-03
    • 1970-01-01
    • 1970-01-01
    • 2016-06-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多