Encoding 带--stdin的unoconv不工作

Encoding 带--stdin的unoconv不工作,encoding,utf-8,stdin,unoconv,Encoding,Utf 8,Stdin,Unoconv,我正在使用unoconv将docx转换为pdf。只要我通过文件名传递文档,一切都很好: $ unoconv -f pdf --stdout test.docx 但一旦我使用--stdin它就不再工作了: $ unoconv -f pdf --stdin --stdout < test.docx Traceback (most recent call last): File "/usr/bin/unoconv", line 1275, in <module> ma

我正在使用
unoconv
docx
转换为
pdf
。只要我通过文件名传递文档,一切都很好:

$ unoconv -f pdf --stdout test.docx
但一旦我使用
--stdin
它就不再工作了:

$ unoconv -f pdf --stdin --stdout < test.docx

Traceback (most recent call last):
  File "/usr/bin/unoconv", line 1275, in <module>
    main()
  File "/usr/bin/unoconv", line 1185, in main
    inputfn = sys.stdin.read()
  File "/usr/lib/python3.5/codecs.py", line 321, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xad in position 41: invalid start byte
$unoconv-f pdf--stdin--stdout
是同一个文件。为什么这样不行


文件如下:

我认为问题在于,
--stdin
选项并没有像人们可能认为的那样发挥作用

在错误消息中,第1185行中的变量名看起来可疑:

inputfn = sys.stdin.read()
事实上,通过检查,从STDIN读取的文本似乎被解释为文件名,而不是文件内容

但是,文件(
man unoconv
)具有误导性:

--stdin
从标准输入读取输入文件(如果提供文件名,则忽略文件名)

这听起来不像是将输入解释为文件名


我建议您考虑一下(可能先检查一下是否已经有了)。

谢谢您的帮助。你说得对。我创建了一个bug报告: