Skip to content
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

fix: support numeric entities with values over 0xFFFF #726

Merged

Conversation

mcdurdin
Copy link
Contributor

Purpose / Goal

Numeric entities over U+FFFF would be truncated to their lower two bytes due to use of String.fromCharCode which only returns a UTF-16 single code unit. Replacing the relevant calls with String.fromCodePoint addresses the problem. (See caniuse.com for compatibility.)

Fixes #725.

Type

Please mention the type of PR

  • Bug Fix
  • Refactoring / Technology upgrade
  • New Feature

Note : Please ensure that you've read contribution guidelines before raising this PR. If your PR is in progress, please prepend [WIP] in PR title. Your PR will be reviewed when [WIP] will be removed from the PR title.

Bookmark this repository for further updates.

Sorry, something went wrong.

@amitguptagwl
Copy link
Member

Thanks for the PR. can you please remove spaces changes? It shows changes on multiple lines unnecessary.

Numeric entities over U+FFFF would be truncated to their lower two bytes
due to use of `String.fromCharCode` which only returns a UTF-16 single
code unit. Replacing the relevant calls with `String.fromCodePoint`
addresses the problem.
@mcdurdin mcdurdin force-pushed the fix/non-bmp-numeric-entities branch from b009425 to c8b4956 Compare February 26, 2025 13:36
@mcdurdin
Copy link
Contributor Author

can you please remove spaces changes

Done, thanks!

@amitguptagwl amitguptagwl merged commit 5b6000a into NaturalIntelligence:master Feb 26, 2025
7 checks passed
@coveralls
Copy link

Coverage Status

coverage: 98.946%. remained the same
when pulling c8b4956 on mcdurdin:fix/non-bmp-numeric-entities
into efd45cf on NaturalIntelligence:master.

@mcdurdin mcdurdin deleted the fix/non-bmp-numeric-entities branch March 14, 2025 00:56
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 this pull request may close these issues.

HTML numeric entities above U+FFFF are truncated during parse
3 participants