Skip to content

Conversation

@DavidBuchanan314
Copy link

@DavidBuchanan314 DavidBuchanan314 commented Dec 23, 2025

Fixes #156

Adds new test cases for encode and decode of unpaired surrogates (Note: I've only run the tests in nodejs thus far).

Fixes utf8ToBytes() behaviour to match that of Buffer.from(string), i.e. to encode unmatched surrogates as U+FFFD, and thus the behaviour is now the same for strings <64 and >64 in length.

I didn't make any changes to the decode behaviour because that seems good already (it performs U+FFFD substitution).

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.

Accepts unpaired surrogate codepoints in both encode and decode

1 participant