UnicodeDecodeError: 'ascii' codec can't decode byte 0xe7 in position 0: ordinal not in range(128)

后端 未结 2 1115
渐次进展
渐次进展 2021-02-04 05:58

I\'m having troubles in encoding characters in utf-8. I\'m using Django, and I get this error when I tried to send an Android notification with non-plain text. I tried to find w

2条回答
  •  伪装坚强ぢ
    2021-02-04 06:22

    Use u'...', without the u prefix it is byte-string not a unicode string.:

    >>> u'ç'.encode('utf8')
    '\xc3\xa7'
    

提交回复
热议问题