Skip to content

Fix (de)serialization of an index containing unicode surrogate characters#7

Merged
lofcz merged 1 commit intolofcz:masterfrom
advdotnet:master
Dec 2, 2025
Merged

Fix (de)serialization of an index containing unicode surrogate characters#7
lofcz merged 1 commit intolofcz:masterfrom
advdotnet:master

Conversation

@advdotnet
Copy link
Copy Markdown
Contributor

Calling SearchEngine.Save leads to an exception if unicode surrogate characters are present in the index.

System.ArgumentException: Unicode surrogate characters must be written out as pairs together in the same call, not individually. Consider passing in a character array instead.

This PR fixes the serialization by writing and reading the char as uint16.

@lofcz
Copy link
Copy Markdown
Owner

lofcz commented Dec 2, 2025

Good catch!

@lofcz lofcz merged commit 39b01f9 into lofcz:master Dec 2, 2025
2 checks passed
lofcz added a commit that referenced this pull request Dec 30, 2025
Fix (de)serialization of an index containing unicode surrogate characters
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.

2 participants