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

CodePointInversionList JSON serialization cannot represent all code points #3892

Closed
skius opened this issue Aug 18, 2023 · 2 comments · Fixed by #3899
Closed

CodePointInversionList JSON serialization cannot represent all code points #3892

skius opened this issue Aug 18, 2023 · 2 comments · Fixed by #3899
Assignees
Labels
C-unicode Component: Props, sets, tries help wanted Issue needs an assignee T-bug Type: Bad behavior, security, privacy

Comments

@skius
Copy link
Member

skius commented Aug 18, 2023

CPIL cannot JSON-serialize a CPIL such as [0-\uDFFF], because the end of the range is not a valid Rust char. We could check while serializing if such code points exist, and if so, fall back to the OldStyle serialization for human-readable. We could also add escaping support to NewStyle.

This is an issue for transform rules such as InterIndic-Arabic that use sets like $nonword = [^\uE000-\uE0FF];

@skius skius added T-bug Type: Bad behavior, security, privacy C-unicode Component: Props, sets, tries help wanted Issue needs an assignee labels Aug 18, 2023
@robertbastian robertbastian self-assigned this Aug 18, 2023
@robertbastian
Copy link
Member

This brings up an interesting question. Even though it's called code point inversion list, it uses char on its API, which doesn't represent code points but scalar values, the difference being that it cannot be a surrogate. So do we actually want/need to store surrogate values in CPIL? If not, we can remove them during construction. Otherwise I think escaping surrogates in JSON is best, as we want to remove OldStyle at some point.

@skius
Copy link
Member Author

skius commented Aug 21, 2023

I was thinking about that as well, especially in connection with UTS#35 UnicodeSets (linking #3893). That spec talks about code points, but it might be worth checking upstream if it's actually scalar values. If UnicodeSets do support all code points, I think that's a good case for CPIL surrogate support

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-unicode Component: Props, sets, tries help wanted Issue needs an assignee T-bug Type: Bad behavior, security, privacy
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants