Skip to content

Commit 708bcbf

Browse files
authored
Merge pull request #153 from ctolkien/turkish-i
Fixes handling of `Turkish I`
2 parents 67aef08 + d1b0b17 commit 708bcbf

File tree

3 files changed

+20
-9
lines changed

3 files changed

+20
-9
lines changed

src/Slugify.Core/SlugHelper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public virtual string GenerateSlug(string inputString)
3434
var normalizedInput = inputString.Normalize(NormalizationForm.FormD);
3535

3636
normalizedInput = Config.TrimWhitespace ? normalizedInput.Trim() : normalizedInput;
37-
normalizedInput = Config.ForceLowerCase ? normalizedInput.ToLower() : normalizedInput;
37+
normalizedInput = Config.ForceLowerCase ? normalizedInput.ToLowerInvariant() : normalizedInput;
3838

3939
var sb = new StringBuilder(normalizedInput);
4040

src/Slugify.Core/Slugify.Core.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<PropertyGroup>
33
<AssemblyTitle>Slugify Core</AssemblyTitle>
44

5-
<VersionPrefix>5.1.0</VersionPrefix>
5+
<VersionPrefix>5.1.1</VersionPrefix>
66
<TargetFramework>netstandard2.0</TargetFramework>
77
<LangVersion>latest</LangVersion>
88
<Nullable>enable</Nullable>
@@ -12,6 +12,7 @@
1212
<PackageId>Slugify.Core</PackageId>
1313
<PackageTags>URL;Slug;Web;Slugify</PackageTags>
1414
<PackageReleaseNotes>
15+
5.1.1 - Fixes issue with Turkish `i` character.
1516
5.1.0 - Adds support for MaximumLength to limit the length of the slug. Thanks @ntbm
1617
5.0.0 - Rewrite using newer language features. Added support for Non-Ascii languages for SlugHelperForNonAsciiLanguages
1718
4.0.0 - Bug fix relase from 3.0.0

tests/Slugify.Core.Tests/SlugHelperTests.cs

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -704,17 +704,27 @@ public void TestHandlingOfUnicodeCharacters(ISlugHelper helper)
704704
}
705705

706706

707-
[Fact(Skip = "We are not culture aware and do not support this.")]
707+
[Fact]
708708
public void TurkishEncodingOfI()
709709
{
710-
//Set culture to Turkish
711-
CultureInfo.CurrentCulture = new CultureInfo("tr-TR");
712-
const string original = "FIFA 18";
713-
const string expected = "fıfa 18";
710+
var defaultCulture = CultureInfo.CurrentCulture;
714711

715-
var helper = CreateNonAscii();
712+
try
713+
{
714+
//Set culture to Turkish
715+
CultureInfo.CurrentCulture = new CultureInfo("tr-TR");
716+
const string original = "FIFA 18";
717+
const string expected = "fifa-18";
716718

717-
Assert.Equal(expected, helper.GenerateSlug(original));
719+
var helper = CreateNonAscii();
720+
721+
Assert.Equal(expected, helper.GenerateSlug(original));
722+
}
723+
finally
724+
{
725+
//Reset culture
726+
CultureInfo.CurrentCulture = defaultCulture;
727+
}
718728

719729
}
720730

0 commit comments

Comments
 (0)