我使用以下python代码来解码“文本”文件:
import codecs, os, sys
fd = open("c:/a.txt", 'rb')
rb = fd.read()
s = codecs.decode(rb, 'utf_7')
print(s)
运行时出现以下错误:
UnicodeDecodeError: 'utf7' codec can't decode byte 0xc3 in position 3: unexpected special character
但是“文本”文件可以由iconv实用程序解码,如下所示:
$iconv -f UTF-8 -t UTF-7 a.txt
01 +ANYA2AC5AOkAywDVAMEAqw
怎么了?你知道吗
你给出的
iconv
等价物是:你漏了一步。你知道吗
相关问题 更多 >
编程相关推荐