NaturalIntelligence / fast-xml-parser

Validate XML, Parse XML and Build XML rapidly without C/C++ based libraries and no callback.
https://naturalintelligence.github.io/fast-xml-parser/
MIT License
2.53k stars 303 forks source link

All special characters are not correctly parsed #637

Open shaun-funke opened 8 months ago

shaun-funke commented 8 months ago

Description

Parsing of all special characters does not render correct XML. FWIW, a simple workaround is to just use a regex to find the other special characters which are not currently being parsed correctly and replace them accordingly, as seen in the Expected output. πŸ™

Input

A jest test be written to test the expected output of parser.

Input: `Example & < > " ' β€œ ” β€˜ ’ Β« Β» β€ž β€œ caption with special characters`

Code

parse()

Output

Received: "Example & < > \" ' &#8220; &#8221; &#8216; &#8217; &#171; &#187; &#8222; &#8220; caption with special characters"

expected data

Expected: "Example &amp; &lt; &gt; &quot; &apos; &#8220; &#8221; &#8216; &#8217; &#171; &#187; &#8222; &#8220; caption with special characters"

Would you like to work on this issue?

Bookmark this repository for further updates. Visit SoloThought to know about recent features.

github-actions[bot] commented 8 months ago

We're glad you find this project helpful. We'll try to address this issue ASAP. You can vist https://solothought.com to know recent features. Don't forget to star this repo.

amitguptagwl commented 7 months ago

What version of the library are you using?

shaun-funke commented 7 months ago

What version of the library are you using?

4.2.5

amitguptagwl commented 7 months ago

Can you please try with latest version? and let me know if you see the issue?