In git I'm trying to use .gitattributes
to compare .odt files, libreofice writer files, with difftool.
From following this guide: http://www-verimag.imag.fr/~moy/opendocument/ I made a .gitattributes
file .gitattributes with this:
*.ods diff=odf
*.odt diff=odf
*.odp diff=odf
*.ods difftool=odf
*.odt difftool=odf
*.odp difftool=odf
This made git diff compare the text in .odt, however when git difftool launches kdiff3 to compare the .odt files, I get this pop-up error:
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.
...and all of the characters in the files are mumbo jumbo.
What went wrong? How do I fix this?
PS:
I don't know if this is important but I guess I haven't configured 'diff.tool', because every time I command:
$ git difftool
I get this output:
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]:
Could that be why kdiff3 doesn't seem to work with odt2txt?
EDIT: I retried to do this with Microsoft Word documents and got a little further here.
I played around with .kdiff3rc configuration... none of the options I added seemed to make the unreadable characters readable. I changed the comparison tool to vimdiff; and when I did git difftool on microsoft word documents, vimdiff displayed a list of files ending in .xml instead of unreadable characters.
When I pushed enter on one of the files this displayed:
<?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>
I posted a new question on this issue here.