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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Built-in JsonNamingPolicy types don't recognize surrogate pairs #90352

Open
eiriktsarpalis opened this issue Aug 10, 2023 · 1 comment
Open
Labels
area-System.Text.Json enhancement Product code improvement that does NOT require public API changes/additions
Milestone

Comments

@eiriktsarpalis
Copy link
Member

eiriktsarpalis commented Aug 10, 2023

Consider the following example:

string value = "饜悁饜惃饜惃饜悁饜惃饜惃"; // surrogate pairs with mixed capitalization

Console.WriteLine(JsonNamingPolicy.CamelCase.ConvertName(value)); // 饜悁饜惃饜惃饜悁饜惃饜惃 should be 饜惃饜惃饜惃饜悁饜惃饜惃
Console.WriteLine(JsonNamingPolicy.SnakeCaseLower.ConvertName(value)); // 饜悁饜惃饜惃饜悁饜惃饜惃 should be 饜惃饜惃饜惃_饜惃饜惃饜惃

Neither JsonNamingPolicy.CamelCase nor JsonNamingPolicy.SnakeCase/KebabCase have support for surrogate pairs. We should consider adding support for surrogate pairs in the future (although that would most likely require #52947).

See eiriktsarpalis@c1c5d1c for a prototype implementation that polyfills Rune.

Related to #90316

@ghost ghost added the untriaged New issue has not been triaged by the area owner label Aug 10, 2023
@dotnet-issue-labeler dotnet-issue-labeler bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Aug 10, 2023
@eiriktsarpalis eiriktsarpalis added enhancement Product code improvement that does NOT require public API changes/additions and removed untriaged New issue has not been triaged by the area owner labels Aug 10, 2023
@eiriktsarpalis eiriktsarpalis added this to the Future milestone Aug 10, 2023
@ghost
Copy link

ghost commented Aug 10, 2023

Tagging subscribers to this area: @dotnet/area-system-text-json, @gregsdennis
See info in area-owners.md if you want to be subscribed.

Issue Details

Consider the following example:

string value = "饜悁饜惃饜惃饜悁饜惃饜惃"; // surrogate pairs with mixed capitalization

Console.WriteLine(JsonNamingPolicy.CamelCase.ConvertName(value)); // 饜悁饜惃饜惃饜悁饜惃饜惃 should be 饜惃饜惃饜惃饜悁饜惃饜惃
Console.WriteLine(JsonNamingPolicy.SnakeCaseLower.ConvertName(value)); // 饜悁饜惃饜惃饜悁饜惃饜惃 should be 饜惃饜惃饜惃_饜惃饜惃饜惃

Neither JsonNamingPolicy.CamelCase nor JsonNamingPolicy.SnakeCase/KebabCase have support for surrogate pairs. We should consider adding support for surrogate pairs in the future (although that would most likely require #52947).

See eiriktsarpalis@c1c5d1c for a prototype implementation that polyfills Rune.

Author: eiriktsarpalis
Assignees: -
Labels:

enhancement, area-System.Text.Json, needs-area-label

Milestone: Future

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-System.Text.Json enhancement Product code improvement that does NOT require public API changes/additions
Projects
None yet
Development

No branches or pull requests

1 participant