Skip to content

Conversation

@lygstate
Copy link

No description provided.

… to `string.encode_to_*`

After doing this, the encode/decode is paired and the direction is clear.
* `string.decode_from_wtf8` decodes using a strict WTF-8 decoder, which is like
UTF-8 but also allows isolated surrogates. If the bytes are not
valid WTF-8, trap.

Copy link
Author

@lygstate lygstate Dec 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the bytes are not valid WTF-8, trap

If this is a case. so we may want
string.decode_from_lossy_wtf8, and for invalid characters, replace it with 0xEF 0xBF 0xBD, that's the UTF-8 encoding of U+FFFD (the replacement character)

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.

1 participant