Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make sure to avoid Surrogate Code points #3

Open
klnusbaum opened this issue Jan 5, 2023 · 0 comments
Open

Make sure to avoid Surrogate Code points #3

klnusbaum opened this issue Jan 5, 2023 · 0 comments

Comments

@klnusbaum
Copy link
Owner

From the Rust documentation:

A char is a ‘Unicode scalar value’, which is any ‘Unicode code point’ other than a surrogate code point. This has a fixed numerical definition: code points are in the range 0 to 0x10FFFF, inclusive. Surrogate code points, used by UTF-16, are in the range 0xD800 to 0xDFFF.

No char may be constructed, whether as a literal or at runtime, that is not a Unicode scalar value

We should do something like "for any generated codepoint equal to or above this range, shift it up by the size of the range so we can guarantee we never put anything in the range, but can also shift back down when decrypting"

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

No branches or pull requests

1 participant