8000 Fixes handling of `Turkish I` by ctolkien · Pull Request #153 · ctolkien/Slugify · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fixes handling of Turkish I 8000 #153

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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Slugify.Core/SlugHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public virtual string GenerateSlug(string inputString)
var normalizedInput = inputString.Normalize(NormalizationForm.FormD);

normalizedInput = Config.TrimWhitespace ? normalizedInput.Trim() : normalizedInput;
normalizedInput = Config.ForceLowerCase ? normalizedInput.ToLower() : normalizedInput;
normalizedInput = Config.ForceLowerCase ? normalizedInput.ToLowerInvariant() : normalizedInput;

var sb = new StringBuilder(normalizedInput);

Expand Down
3 changes: 2 additions & 1 deletion src/Slugify.Core/Slugify.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<PropertyGroup>
<AssemblyTitle>Slugify Core</AssemblyTitle>

<VersionPrefix>5.1.0</VersionPrefix>
<VersionPrefix>5.1.1</VersionPrefix>
<TargetFramework>netstandard2.0</TargetFramework>
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
Expand All @@ -12,6 +12,7 @@
<PackageId>Slugify.Core</PackageId>
<PackageTags>URL;Slug;Web;Slugify</PackageTags>
<PackageReleaseNotes>
5.1.1 - Fixes issue with Turkish `i` character.
5.1.0 - Adds support for MaximumLength to limit the length of the slug. Thanks @ntbm
5.0.0 - Rewrite using newer language features. Added support for Non-Ascii languages for SlugHelperForNonAsciiLanguages
4.0.0 - Bug fix relase from 3.0.0
Expand Down
24 changes: 17 additions & 7 deletions tests/Slugify.Core.Tests/SlugHelperTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -704,17 +704,27 @@ public void TestHandlingOfUnicodeCharacters(ISlugHelper helper)
}


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

var helper = CreateNonAscii();
try
{
//Set culture to Turkish
CultureInfo.CurrentCulture = new CultureInfo("tr-TR");
const string original = "FIFA 18";
const string expected = "fifa-18";

Assert.Equal(expected, helper.GenerateSlug(original));
var helper = CreateNonAscii();

Assert.Equal(expected, helper.GenerateSlug(original));
}
finally
{
//Reset culture
CultureInfo.CurrentCulture = defaultCulture;
}

}

Expand Down
0