小编cyh*_*hao的帖子

为什么我不能解码python2.7中的'utf8'字符串?

我用python写:

'\xF5\x90\x90\x90'.decode('utf8')
Run Code Online (Sandbox Code Playgroud)

但它会导致错误:

UnicodeDecodeError: 'utf8' codec can't decode byte 0xf5 in position 0: invalid start byte
Run Code Online (Sandbox Code Playgroud)

该字符串\xF5\x90\x90\x90是标准的'utf8'字符串.它的二进制是11110101 10010000 10010000 10010000.遵守utf8:11110xxx 10xxxxxx 10xxxxxx 10xxxxxx的规则

为什么我不能解码这个字符串?

python standards decode utf-8 python-2.7

3
推荐指数
1
解决办法
187
查看次数

标签 统计

decode ×1

python ×1

python-2.7 ×1

standards ×1

utf-8 ×1