Shoobx / xmldiff

A library and command line utility for diffing xml

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ValueError: Unknown diff format due to wrong encoding of diff

slamer59 opened this issue · comments

On windows with Powershell,
I took for the exemple insert-node.left.xml

xmldiff .\insert-node.left.xml .\insert-node.right.xml > insert-gen.diff

This lead on my machine to UTF 16 with BOM which is not read by xmlpatch

xmlpatch.exe .\insert-gen.diff .\insert-node.left.xml
gives : ValueError: Unknown diff format

This error is raised here:

result = patch_file(args.patchfile, args.xmlfile)

and can be fixed by #80

This might work too:
print(result.encode('utf-8'))

Aha, so your console is in UTF-16. I have added a --diff-encoding parameter to xmldiff, which will be included in v2.5.