content
content copied to clipboard
Issue with "TextDecoder.prototype.decode()": unicode 0x0028 and unicode 0x2028 is the same
MDN URL: https://developer.mozilla.org/en-US/docs/Web/API/TextDecoder/decode
What information was incorrect, unhelpful, or incomplete?
Comparing decoded unicodes between 0x0028 vs 0x2028.
Specific section or headline?
Not sure.
What did you expect to see?
0x2028 is line separator 0x0028 is open/left parenthesis
according to:
- https://en.wikipedia.org/wiki/List_of_Unicode_characters#General_Punctuation
- https://www.ssec.wisc.edu/~tomw/java/unicode.html
Did you test this? If so, how?
// using int
decoder.decode(new Uint8Array([40])) === decoder.decode(new Uint8Array([8232]));
> true
// using hex
decoder.decode(new Uint8Array([0x0028])) === decoder.decode(new Uint8Array([0x2028]));
> true
Note The same issue occurred on the closing parenthesis vs 0x2029 (paragraph separator)
MDN Content page report details
- Folder:
en-us/web/api/textdecoder/textdecoder - MDN URL: https://developer.mozilla.org/en-US/docs/Web/API/TextDecoder/TextDecoder
- GitHub URL: https://github.com/mdn/content/blob/main/files/en-us/web/api/textdecoder/textdecoder/index.md
- Last commit: https://github.com/mdn/content/commit/e591ab4725d8c5353d0e6eb949ca1586620a1e87
- Document last modified: 2022-01-21T19:01:59.000Z
hmmm it might be my mistake.
0x2028 seems to be outside of Uint8 max limit.
I should use Uint32.