在 git 中,我尝试使用.gitattributes
difftool 比较 .odt 文件、libreofice 编写器文件。从遵循本指南:http ://www-verimag.imag.fr/~moy/opendocument/我制作了一个.gitattributes
文件 .gitattributes :
*.ods diff=odf
*.odt diff=odf
*.odp diff=odf
*.ods difftool=odf
*.odt difftool=odf
*.odp difftool=odf
这使得 git diff 比较 .odt 中的文本,但是当 git difftool 启动 kdiff3 来比较 .odt 文件时,我收到以下弹出错误:
Some input characters could not be converted to valid unicode.
You might be using the wrong codec. (e.g. UTF-8 for non UTF-8 files).
Don't save the result if unsure. Continue at your own risk.
Affected input files are in A, B.
...文件中的所有字符都是胡说八道。
什么地方出了错?我该如何解决?
PS:
我不知道这是否重要,但我想我没有配置'diff.tool',因为每次我命令时:
$ git difftool
我得到这个输出:
This message is displayed because 'diff.tool' is not configured.
See 'git difftool --tool-help' or 'git help config' for more details.
'git difftool' will now attempt to use one of the following tools:
opendiff kdiff3 tkdiff xxdiff meld kompare gvimdiff diffuse diffmerge ecmerge p4merge araxis bc codecompare emerge vimdiff
Viewing (1/1): 'diffexperiment.odt'
Launch 'kdiff3' [Y/n]:
这就是为什么 kdiff3 似乎不适用于 odt2txt 的原因吗?
编辑:我尝试使用 Microsoft Word 文档执行此操作,并在此处更进一步。
我玩弄了 .kdiff3rc 配置...我添加的任何选项似乎都没有使不可读的字符可读。我将比较工具更改为 vimdiff;当我在 microsoft word 文档上执行 git difftool 时,vimdiff 显示以 .xml 结尾的文件列表,而不是不可读的字符。
当我在其中一个显示的文件上按 Enter 键时:
<?xml version="1.0" encoding="UTF-8"?>
" Browsing zipfile /tmp/4LMJbj_HI I am writing something here..docx |<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"><Override PartName
" Select a file with cursor and press ENTER |="/_rels/.rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/><Overr
|ide PartName="/word/settings.xml" ContentType="application/vnd.openxmlformats-officedocument.w
_rels/.rels |ordprocessingml.settings+xml"/><Override PartName="/word/_rels/document.xml.rels" ContentType=
word/settings.xml |"application/vnd.openxmlformats-package.relationships+xml"/><Override PartName="/word/fontTabl
word/_rels/document.xml.rels |e.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.fontTable+x
word/fontTable.xml |ml"/><Override PartName="/word/styles.xml" ContentType="application/vnd.openxmlformats-officed
word/numbering.xml |ocument.wordprocessingml.styles+xml"/><Override PartName="/word/document.xml" ContentType="app
word/styles.xml |lication/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml"/><Override Part
word/document.xml |Name="/docProps/app.xml" ContentType="application/vnd.openxmlformats-officedocument.extended-p
docProps/app.xml |roperties+xml"/><Override PartName="/docProps/core.xml" ContentType="application/vnd.openxmlfo
docProps/core.xml |rmats-package.core-properties+xml"/>
[Content_Types].xml |</Types>
我在这里发布了一个关于这个问题的新问题。