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

Invalid code point #48

Closed
sjlu opened this issue Jan 13, 2021 · 7 comments
Closed

Invalid code point #48

sjlu opened this issue Jan 13, 2021 · 7 comments

Comments

@sjlu
Copy link

sjlu commented Jan 13, 2021

When decoding the following string: In today�s digital marketplace

It results in this error:

RangeError: Invalid code point 2013266066
  at Object.fromCodePoint (<anonymous>)
  at /Users/sjlu/Code/interseller/node_modules/html-entities/lib/html5-entities.js:27:49
  at String.replace (<anonymous>)
  at Html5Entities.decode (/Users/sjlu/Code/interseller/node_modules/html-entities/lib/html5-entities.js:16:20)
node --version
v12.18.3
@sjlu
Copy link
Author

sjlu commented Jan 13, 2021

The previous error was from 1.4.0. 2.0.2 produces a similar error:

RangeError: Invalid code point 2013266066
     at Object.fromCodePoint (<anonymous>)
     at /Users/sjlu/Code/interseller/node_modules/html-entities/lib/index.js:1:2512
     at String.replace (<anonymous>)
     at a.decode (/Users/sjlu/Code/interseller/node_modules/html-entities/lib/index.js:1:2332)

@mdevils
Copy link
Owner

mdevils commented Jan 13, 2021

Hello @sjlu, is it actually a valid html entity / unicode character?

@sjlu
Copy link
Author

sjlu commented Jan 13, 2021

@mdevils I don't think so, but should decode leave it be and skip the character in the string rather than failing with an error?

@mdevils
Copy link
Owner

mdevils commented Jan 22, 2021

@sjlu good point.

@mdevils
Copy link
Owner

mdevils commented Jan 22, 2021

Fixed in 2.0.3

@sjlu
Copy link
Author

sjlu commented Jan 22, 2021

Awesome, thanks @mdevils

@mdevils
Copy link
Owner

mdevils commented Jan 25, 2021

The fix was modified to mimic browser behaviour.

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

No branches or pull requests

2 participants