Skip to content

Version 5.7.x stops decoding HTML entities by default #829

Closed

Description

@nunomarks

Description

It seems like 5.7.0 introduced a change to how it decodes HTML entities. I suspect this is the bump from @nodable/entities@1.1.0 to @nodable/entities@2.1.0. If an XML value includes a numeric HTML entity such as ' (apostrophe), it doesn't get decoded.

Expected behaviour

' should get decoded to '.

Observed behaviour

' doesn't get decoded.

Status

For now we're stuck with 5.6.0, but this is breaking in the sense that the parsing doesn't produce the same string values.

Environment

  • Lib Version: 5.7.0 / 5.7.1 / 5.7.2
  • Node Version: 24.15.0

Should you need more information, please let me know.

Activity

  1. github-actions commented on May 2, 2026

    @github-actions

    We're glad you find this project helpful. We'll try to address this issue ASAP. You can join Discord channel(https://discord.gg/X4Qp9u6Vz) for anonucements and pre release discussions. Don't forget to star this repo.

  2. amitguptagwl commented on May 2, 2026

    @amitguptagwl
    Member

    can you please let me know options you're setting? I hope you're not setting it externally.

  3. nunomarks commented on May 3, 2026

    @nunomarks
    Author

    This is how I'm settings the parser instance:

    const xmlParser = new XMLParser({ ignoreAttributes: false, attributeNamePrefix: '@' });
    
  4. nunomarks commented on May 3, 2026

    @nunomarks
    Author

    And this is sample xml you can test with:

    <Tag>
    	<Data Value="And it&#39;s a sample" />
    </Tag>
  5. TheDeathConqueror commented on May 3, 2026

    @TheDeathConqueror
    Contributor
  6. nunomarks commented on May 3, 2026

    @nunomarks
    Author

    This is how it used to work on 5.6.0, so how we currently have on our codebase. This was broken on the 5.7.0 upgrade, so the numeric html entities (as the above) now don't get decoded.

  7. amitguptagwl commented on May 3, 2026

    @amitguptagwl
    Member

    numeric entities were being controlled by htmlEntity flag only as in v5.7.2. Were you setting external entities?

  8. nunomarks commented on May 4, 2026

    @nunomarks
    Author

    Were you setting external entities?

    No, we're merely instantiating the parser with those options shown above.

  9. amitguptagwl commented on May 5, 2026

    @amitguptagwl
    Member

    I can't comment on how your previous code was implemented but this is working fine when required config is set.

    {
        "Data": {
            "Value": "And it's a sample"
        }
    }
    
  10. nunomarks commented on May 5, 2026

    @nunomarks
    Author

    Here's a repro case: https://github.com/nunomarks/fxp-repro. With the default configuration, the html entities fail to get decoded. If you change the version to 5.6.0, then it works.

  11. amitguptagwl commented on May 5, 2026

    @amitguptagwl
    Member

    Thanks to highlight. It might be because I included entities library in that version but then migrated to its new version. But I cant confirm. Do you want me to further investigate it and mark v5.6.0 deprecated? If you really need it I can look into this as soon as I get some bandwidth.

  12. nunomarks commented on May 5, 2026

    @nunomarks
    Author

    We're fine at 5.6.0, it's not blocking us, so we can wait for the investigation whenever you have the bandwidth. Thank you!

  13. amitguptagwl commented on May 6, 2026

    @amitguptagwl
    Member

    How would that investigation help you? What is your expectation from that? You would have to either switch to older version 5.5.X or newer version 5.7.X if 5.6.0 was found to be culprit.

  14. nunomarks commented on May 6, 2026

    @nunomarks
    Author

    How would that investigation help you? What is your expectation from that? You would have to either switch to older version 5.5.X or newer version 5.7.X if 5.6.0 was found to be culprit.

    Wasn't the "breaking version" 5.7.0? Because, according to the reproducible case, it is the affected version, not 5.6.0. We still see normal entity decoding on 5.6.0

  15. amitguptagwl commented on May 6, 2026

    @amitguptagwl
    Member

    5.7.0 explicitly throwing error when user were setting numerical entities as external entity as it was already supported internally since v4.x. But since some projects were still using that hack, 5.7.2 was released to allow it, however, it makes no sense and no new project is expected to set numerical entities externally.

    But this is not the case with you in my understanding. So I dont see any reason why you cant use v5.7.2. I'll again repeat numerical entities were supposed to be used through htmlEntity flag only in past.

    You must check changelog for better understanding.

  16. nunomarks commented on May 6, 2026

    @nunomarks
    Author

    So what you're saying is that upgrading to v5.7.2 and setting htmlEntities: true is the right fix, am I right to assume that?

  17. nunomarks commented on May 20, 2026

    @nunomarks
    Author

    @amitguptagwl could you confirm my previous statement?

  18. nunomarks commented on May 29, 2026

    @nunomarks
    Author
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions