Skip to content

fix(msgpack-cs): fix UTF-8 encoding of UTF-16 surrogate pairs#7

Merged
prikolium-cfx merged 1 commit intocitizenfx:masterfrom
poco8537:fix/utf8
Jul 30, 2025
Merged

fix(msgpack-cs): fix UTF-8 encoding of UTF-16 surrogate pairs#7
prikolium-cfx merged 1 commit intocitizenfx:masterfrom
poco8537:fix/utf8

Conversation

@poco8537
Copy link
Contributor

@poco8537 poco8537 commented Jul 1, 2025

Goal of this PR

Fix incorrect UTF-8 encoding logic by properly handling surrogate pairs in UTF-16 input.

How is this PR achieving the goal

This PR updates the UTF-8 encoding functions to correctly detect and encode surrogate pairs as 4-byte UTF-8 sequences. It also adds fallback encoding for invalid or unmatched surrogates using the replacement character (U+FFFD).

@manups4e
Copy link
Contributor

manups4e commented Jul 2, 2025

Looks pretty good to me.

@prikolium-cfx prikolium-cfx merged commit 133b8c6 into citizenfx:master Jul 30, 2025
1 check passed
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.

3 participants