Case-map İ and ı, which the invariant mapping leaves alone [patch] - #101
Merged
Merged
Conversation
.NET's invariant casing deliberately leaves U+0130 "İ" and U+0131 "ı" unmapped, so snake, kebab and camel output kept an uppercase "İ" and MACRO and Pascal output kept a lowercase "ı". Route the casing calls through helpers that apply Unicode's simple mappings for those two letters, and fix them up around TextInfo.ToTitleCase so a word can start with "I" rather than "ı". A culture's TextInfo is not used, because its result depends on the installed ICU data. Fixes #97 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AtF6Ynq3K6Km6HSRHaKuX8
|
This was referenced Sep 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Fixes #97
What changed
.NET's invariant casing deliberately leaves U+0130
İand U+0131ıunmapped. As a result, snake, kebab and camel output kept an uppercaseİ, and MACRO and Pascal output kept a lowercaseı.Case-mapping helpers.
ToUpperInvariantFullandToLowerInvariantFullapply the invariant mapping, then patch those two letters to their Unicode simple mappings (ı→I,İ→i). A cultureTextInfois not used, because its result depends on the installed ICU data. Every casing call goes through the helpers:IsLowercaseWithNoUppercase. Before this changeıcounted as "no uppercase form", which also made"ı".IsAllCaps()return true.Title case.
TitleCaseKeepingTypographicApostrophesswapsİ/ıforI/ibefore the invariantTextInfo.ToTitleCaseruns. It then reads each result back:Imeans the letter starts a word, soİis kept andıbecomesIimeans it does not, soİbecomesiandıis keptThis is what makes
"ılık su".ToPascalCase()giveIlıkSu."İZMİR"normalizes toİzmir, the same as"İzmir"does."İzmir city".ToSnakeCase()İzmir_cityizmir_city"İzmir city".ToCamelCase()İzmirCityizmirCity"İstanbul".ToLowercaseFirstChar()İstanbulistanbul"kırmızı".ToMacroCase()KıRMıZıKIRMIZI"ılık su".ToPascalCase()ılıkSuIlıkSu"ılık su".ToUppercaseFirstChar()ılık suIlık suOut of scope
ToSnakeCasestill lowercases theToMacroCaseoutput, so a lowercaseıround-trips toiin snake/kebab case ("kırmızı".ToSnakeCase()→kirmizi). The camel path has the same problem for a leadingı. That upper→lower round trip is #84, so these tests don't assert those outputs.Testing
İacross all five converters,ırows for Pascal and Macro, the first-char helpers andToTitleCase,ToMacroCaseidempotence onkırmızı/İzmir city/ılık su, andIsAllCapsonı.dotnet build CaseConverter.slnbuilds every target (net10.0/9.0/8.0, netstandard2.0/2.1) with 0 warnings.🤖 Generated with Claude Code
https://claude.ai/code/session_01AtF6Ynq3K6Km6HSRHaKuX8
Generated by Claude Code