Python UnicodeDecodeError:';utf-8';无法解码字节0x81

Python UnicodeDecodeError:';utf-8';无法解码字节0x81,python,utf-8,arelle,Python,Utf 8,Arelle,我正在尝试使用arelle读取XBRL填充的zip文件 这是通过发出以下命令来完成的: C:\a>python arelleCmdLine.py -f C:\Python33\sec\2010\03\0000002809-0001047469-10 -002778-xbrl.zip 我收到一个UnicodeDecodeError C:\a>python arelleCmdLine.py -f C:\Python33\sec\2010\03\0000002809-0001047469

我正在尝试使用arelle读取
XBRL
填充的
zip
文件

这是通过发出以下命令来完成的:

C:\a>python arelleCmdLine.py -f C:\Python33\sec\2010\03\0000002809-0001047469-10
-002778-xbrl.zip
我收到一个
UnicodeDecodeError

C:\a>python arelleCmdLine.py -f C:\Python33\sec\2010\03\0000002809-0001047469-10
-002778-xbrl.zip
[xmlSchema:syntax] Unrecoverable error: 'utf-8' codec can't decode byte 0x81 in
position 11: invalid start byte, 0000002809-0001047469-10-002778-xbrl.zip, impor
ting source element - 0000002809-0001047469-10-002778-xbrl.zip
Traceback (most recent call last):
  File "C:\a\arelle\ModelDocument.py", line 131, in load
    xmlDocument = etree.parse(file,parser=_parser,base_url=filepath)
  File "lxml.etree.pyx", line 3239, in lxml.etree.parse (src\lxml\lxml.etree.c:6
9970)
  File "parser.pxi", line 1770, in lxml.etree._parseDocument (src\lxml\lxml.etre
e.c:102272)
  File "parser.pxi", line 1790, in lxml.etree._parseFilelikeDocument (src\lxml\l
xml.etree.c:102531)
  File "parser.pxi", line 1685, in lxml.etree._parseDocFromFilelike (src\lxml\lx
ml.etree.c:101457)
  File "parser.pxi", line 1134, in lxml.etree._BaseParser._parseDocFromFilelike
(src\lxml\lxml.etree.c:97084)
  File "parser.pxi", line 582, in lxml.etree._ParserContext._handleParseResultDo
c (src\lxml\lxml.etree.c:91290)
  File "parser.pxi", line 679, in lxml.etree._handleParseResult (src\lxml\lxml.e
tree.c:92441)
  File "lxml.etree.pyx", line 327, in lxml.etree._ExceptionContext._raise_if_sto
red (src\lxml\lxml.etree.c:10196)
  File "parser.pxi", line 373, in lxml.etree._FileReaderContext.copyToBuffer (sr
c\lxml\lxml.etree.c:89098)
  File "C:\Python33\lib\codecs.py", line 301, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x81 in position 11: invalid
 start byte
它与
utf-8
编码和它所代表的字符有关,但我不知道该怎么办。
我找到了一些,但没有帮助我解决这个问题。

根据unicode字节数据库,快速搜索后,出现错误的字节似乎是
Ctrl
键。由于
Ctrl
的外观仅作为一个haxi数字存在,并且没有自己的字母,我认为
utf
无法将其打印为可见字符,因此出现了上述错误。

这个问题是因为程序需要解析的不是整个Zip文件夹,而是特定的文件(在本例中为实例文件夹),它位于zip文件夹的子目录中

要访问zip目录,请执行以下操作:

If our file inside the zip directory is 1.xml
C:\a>python arelleCmdLine.py -f C:\Python33\sec\2010\03\0000002809-0001047469-10
-002778-xbrl.zip\1.xml
判决:


UnicodeDecodeError:“utf-8”无法解码字节0x81是由于上述原因造成的。

Zip存档文件不在utf-8中。您必须对其进行解压缩。它不是键,而是字节,发生错误是因为输入的utf-8无效。