Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ValueError: Unknown diff format due to wrong encoding of diff #81

Closed
slamer59 opened this issue Nov 25, 2021 · 1 comment
Closed

ValueError: Unknown diff format due to wrong encoding of diff #81

slamer59 opened this issue Nov 25, 2021 · 1 comment

Comments

@slamer59
Copy link

slamer59 commented Nov 25, 2021

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'))

@regebro
Copy link
Contributor

regebro commented Jan 11, 2023

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

@regebro regebro closed this as completed Jan 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants