Repository navigation
Keep combining marks and non-ASCII digits in Pascal, Camel, Snake, Kebab and Macro case [patch] - #108
Merged
Conversation
…bab and Macro case [patch] ReplaceNonAlphaNumericWithSpace kept only letters and ASCII digits, so Devanagari vowel signs and viramas, the accents of NFD Latin text, and Arabic-Indic or Devanagari digits were replaced with spaces: "हिन्दी भाषा".ToSnakeCase() gave "ह_न_द_भ_ष". Combining marks (Mn, Mc, Me) and Unicode decimal digits are now kept. IsWordBoundary never breaks before a combining mark and judges what follows against the letter the marks attach to, and the all-caps word scan treats a mark as part of its word. Fixes #80 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015ef5k7pqkftQmMd6x5w9xM
|
This was referenced Oct 6, 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 #80
What changed
ReplaceNonAlphaNumericWithSpacenow keeps combining marks (NonSpacingMark,SpacingCombiningMark,EnclosingMark) and every Unicode decimal digit (char.IsDigit(input, i)). Before, it kept only letters and ASCII0–9.IsWordBoundarynever breaks before a combining mark. It also judges the code point after the marks against the letter they attach to, using the newSkipBackOverCombiningMarks. So"caféBar"still splits before theB.IsWordCharacter, used by the all-caps word normaliser, counts a combining mark as part of its word."ÉCLAIR"therefore normalises the same way as"éclair".हिन्दी भाषाToSnakeCase()ह_न_द_भ_षहिन्दी_भाषाहिन्दी भाषाToPascalCase()हनदभषहिन्दीभाषाéclair(NFD)ToPascalCase()EClairÉclaircafé au lait(NFD)ToPascalCase()CafeAuLaitCaféAuLaitx١٢٣yToSnakeCase()x_yx_١٢٣yInteraction with #107 (#78): the issue's table expects
"x١٢٣y".ToPascalCase()to give"X١٢٣Y". The maintainer decided on #78 that a letter after a digit does not start a word, so once #107 merges that output becomes"X١٢٣y". To keep these tests valid either way, the Pascal and Camel cases here use"x١٢٣ y". The two branches merge cleanly with each other (checked withgit merge-tree).Tests
CombiningMarksAndNonAsciiDigitsShouldBeKeptchecks Devanagari, NFD Latin, Arabic-Indic digits and Devanagari digits across Pascal, Camel, Snake, Kebab and Macro.A caseless script such as Devanagari cannot round-trip through PascalCase, because no capital marks where a word starts. That assertion is therefore limited to cased text.
🤖 Generated with Claude Code
https://claude.ai/code/session_015ef5k7pqkftQmMd6x5w9xM
Generated by Claude Code