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

Unable to parse ISO-8859-1 XML #164

Closed
cgardner opened this issue Sep 17, 2021 · 5 comments · Fixed by #165
Closed

Unable to parse ISO-8859-1 XML #164

cgardner opened this issue Sep 17, 2021 · 5 comments · Fixed by #165
Labels
bug Something isn't working

Comments

@cgardner
Copy link

Describe the bug
I'm not able to use dasel to parse an XML file that is ISO-8859-1 encoded.

To Reproduce
Steps to reproduce the behavior:

  1. Create a file with the example XML from below
  2. Execute dasel -f /path/to/example.xml -p xml
  3. The command will fail with the following message:

    Error: could not load input: could not unmarshal data: xml.Decoder.Token() - xml: encoding "ISO-8859-1" declared but Decoder.CharsetReader is nil

<!-- example.xml -->
<?xml version="1.0" encoding="ISO-8859-1"?>
<response>
</response>

Expected behavior
I would expect to be able to use dasel with these files

Desktop (please complete the following information):

  • OS: MacOS 10.15.7
  • Version: 1.20.0
@cgardner cgardner added the bug Something isn't working label Sep 17, 2021
@TomWright
Copy link
Owner

Hi @cgardner,

I'm away from home for a couple of days but will check this out when I'm back

@brenol
Copy link
Contributor

brenol commented Sep 23, 2021

Hit this myself when using dasel Go's API directly, and found a simple fix inside mxj :) Opened a PR, hope it helps!

@TomWright
Copy link
Owner

Thanks to @brenol - this was fixed in #165

I'll release this shortly under v1.20.1.

@TomWright TomWright reopened this Sep 28, 2021
@TomWright
Copy link
Owner

This issue is now solved.

$ cat test.xml
<!-- example.xml -->
<?xml version="1.0" encoding="ISO-8859-1"?>
<response>
</response>

$ dasel -v
dasel version v1.20.1

$ dasel -f test.xml .
<response/>

@cgardner
Copy link
Author

That worked! Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants