From 65e123ff65fda8291a493d8135a520bb2f824bd5 Mon Sep 17 00:00:00 2001 From: hangy Date: Sun, 31 Jul 2016 12:23:22 +0200 Subject: [PATCH] Pass through the content of the "Letter, other" Unicode category. fixes Humanizr/Humanizer#578 --- src/Humanizer.Tests.Shared/StringHumanizeTests.cs | 7 +++++++ src/Humanizer/StringHumanizeExtensions.cs | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Humanizer.Tests.Shared/StringHumanizeTests.cs b/src/Humanizer.Tests.Shared/StringHumanizeTests.cs index ba05d6b6c..ae8656d08 100644 --- a/src/Humanizer.Tests.Shared/StringHumanizeTests.cs +++ b/src/Humanizer.Tests.Shared/StringHumanizeTests.cs @@ -32,6 +32,13 @@ public void CanHumanizeStringInPascalCaseInTurkish(string input, string expected Assert.Equal(expectedResult, input.Humanize()); } + [Theory, UseCulture("ar")] + [InlineData("جمهورية ألمانيا الاتحادية", "جمهورية ألمانيا الاتحادية")] + public void CanHumanizeOtherUnicodeLetter(string input, string expectedResult) + { + Assert.Equal(expectedResult, input.Humanize()); + } + [Theory] [InlineData("Underscored_input_string_is_turned_into_sentence", "Underscored input string is turned into sentence")] [InlineData("Underscored_input_String_is_turned_INTO_sentence", "Underscored input String is turned INTO sentence")] diff --git a/src/Humanizer/StringHumanizeExtensions.cs b/src/Humanizer/StringHumanizeExtensions.cs index 3c4a50f5a..b4fe36273 100644 --- a/src/Humanizer/StringHumanizeExtensions.cs +++ b/src/Humanizer/StringHumanizeExtensions.cs @@ -14,7 +14,7 @@ public static class StringHumanizeExtensions static StringHumanizeExtensions() { - PascalCaseWordPartsRegex = new Regex(@"[\p{Lu}]?[\p{Ll}]+|[0-9]+[\p{Ll}]*|[\p{Lu}]+(?=[\p{Lu}][\p{Ll}]|[0-9]|\b)", + PascalCaseWordPartsRegex = new Regex(@"[\p{Lu}]?[\p{Ll}]+|[0-9]+[\p{Ll}]*|[\p{Lu}]+(?=[\p{Lu}][\p{Ll}]|[0-9]|\b)|[\p{Lo}]+", RegexOptions.IgnorePatternWhitespace | RegexOptions.ExplicitCapture | RegexOptionsUtil.Compiled); FreestandingSpacingCharRegex = new Regex(@"\s[-_]|[-_]\s", RegexOptionsUtil.Compiled); }