Decoding double encoded utf8 in Python

后端 未结 3 1997
野性不改
野性不改 2020-12-05 05:04

I\'ve got a problem with strings that I get from one of my clients over xmlrpc. He sends me utf8 strings that are encoded twice :( so when I get them in python I have an uni

3条回答
  •  粉色の甜心
    2020-12-05 05:39

    >>> s = u'Rafa\xc5\x82'
    >>> s.encode('raw_unicode_escape').decode('utf-8')
    u'Rafa\u0142'
    >>>
    

提交回复
热议问题