xmlbuilder2 icon indicating copy to clipboard operation
xmlbuilder2 copied to clipboard

Encoding issue when & html entity is followed by a ";" not preceded by a "&".

Open Laurianti opened this issue 4 years ago • 1 comments

Hello, I think this is a strange behaviour:

Code:

console.log('--- input ---------------------------------------------');
console.log(input);
var output = create(input);
console.log('--- output --------------------------------------------');
console.log(output.toString({prettyPrint: true}));

Output:

--- input ---------------------------------------------
<?xml version="1.0"?>
<testsuites>
  <testsuite>
    <testcase name="&amp;"/>
    <!-- OK -->
    <testcase name="&quot;"/>
    <!-- OK -->
    <testcase name="&amp;&amp;"/>
    <!-- OK -->
    <testcase name="&quot;&quot;"/>
    <!-- OK -->
    <testcase name="&amp;&quot;"/>
    <!-- OK -->
    <testcase name="&amp;&fake;"/>
    <!-- OK -->
    <testcase name="&amp;&;"/>
    <!-- OK -->
    <testcase name="&quot;;"/>
    <!-- OK -->
    <testcase name="&quot;!;"/>
    <!-- OK -->
    <testcase name="&amp;;"/>
    <!-- BROKEN -->
    <testcase name="&amp;!;"/>
    <!-- BROKEN -->
    <testcase name="&amp;abc;def"/>
    <!-- BROKEN -->
    <testcase name="Hello &amp; world today; or tomorrow"/>
    <!-- BROKEN -->
  </testsuite>
</testsuites>

--- output --------------------------------------------
<?xml version="1.0"?>
<testsuites>
  <testsuite>
    <testcase name="&amp;"/>
    <!-- OK -->
    <testcase name="&quot;"/>
    <!-- OK -->
    <testcase name="&amp;&amp;"/>
    <!-- OK -->
    <testcase name="&quot;&quot;"/>
    <!-- OK -->
    <testcase name="&amp;&quot;"/>
    <!-- OK -->
    <testcase name="&amp;&fake;"/>
    <!-- OK -->
    <testcase name="&amp;&;"/>
    <!-- OK -->
    <testcase name="&quot;;"/>
    <!-- OK -->
    <testcase name="&quot;!;"/>
    <!-- OK -->
    <testcase name="&;"/>
    <!-- BROKEN -->
    <testcase name="&!;"/>
    <!-- BROKEN -->
    <testcase name="&abc;def"/>
    <!-- BROKEN -->
    <testcase name="Hello & world today; or tomorrow"/>
    <!-- BROKEN -->
  </testsuite>
</testsuites>

This happen when & html entity is followed by a ";" not preceded by a "&".

Should be fixed?

Laurianti avatar Oct 08 '21 21:10 Laurianti

@oozcitak : Hi Ozgur, This issues is pretty blocking for us. Do you know if and when we could expect a fix? Kind regards, Henk

HenkBoxma avatar Nov 12 '21 14:11 HenkBoxma

Is there any update on merging this change anytime soon? I'm also experiencing this issue and I see this has been open since last year.

jgrubb16 avatar Nov 08 '22 19:11 jgrubb16

@oozcitak Just made #154 to help bring this across the finish line.

jgrubb16 avatar Nov 15 '22 15:11 jgrubb16