Skip to content

Fails to Encode Entities #1

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

Open
ComedyTomedy opened this issue Apr 9, 2021 · 1 comment · May be fixed by #2
Open

Fails to Encode Entities #1

ComedyTomedy opened this issue Apr 9, 2021 · 1 comment · May be fixed by #2

Comments

@ComedyTomedy
Copy link

Hello! I'm aware this is a pretty old library, but libxml2 deletes all my namespaces. So xml.el it is, and your xml-to-string seems to still be the discerning connoisseur's way to re-serialise it.

However I've discovered a bug - xml-to-string doesn't encode entities.

(let ((expected-output "<xml title=\"&amp;\">&amp;</xml>"))
 (xml-to-string
  (with-temp-buffer
    (insert expected-output)
    (xml-parse-region
     (point-min)
     (point-max)))))

The fix is to use the function (xml-escape-string ) when writing CDATA and attribute values.

ComedyTomedy added a commit to ComedyTomedy/xml-to-string that referenced this issue Apr 9, 2021
This might not cover all cases, but if it does, it closes upgradingdave#1
@ComedyTomedy ComedyTomedy linked a pull request Apr 11, 2021 that will close this issue
@ComedyTomedy
Copy link
Author

Oops thought I'd added a PR, turns out I don't actually know how to use Git(Hub).

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

Successfully merging a pull request may close this issue.

1 participant