oozcitak/xmlbuilder2

HTML Entities are unescaped when creating using json object

chris-rudmin opened this issue · 1 comments

Describe the bug
HTML Entities are unescaped when creating xml using a json object

To Reproduce

create().ele({
    'foo': ''"©℗™'
}).end()

// <?xml version="1.0"?><foo>'"©℗™</foo>
create().ele('foo').txt('&apos;&quot;&#xA9;&#x2117;&#x2122;').end()
// <?xml version="1.0"?><foo>&apos;&quot;&#xA9;&#x2117;&#x2122;</foo>

Expected behavior
text should remain as it was input and should be consistent with the chained builder

Version:

  • node.js: [14.18.1]
  • xmlbuilder2 [3.0.2]

Additional context

This looks like a duplicate of various issues that have been opened related to ampersand encoding (see #105, #109, #110). I believe this to be fixed with the release of v3.1.0. Please reopen if you can still reproduce after upgrading.