Unidecode.NET
2.2.1
dotnet add package Unidecode.NET --version 2.2.1
NuGet\Install-Package Unidecode.NET -Version 2.2.1
<PackageReference Include="Unidecode.NET" Version="2.2.1" />
<PackageVersion Include="Unidecode.NET" Version="2.2.1" />
<PackageReference Include="Unidecode.NET" />
paket add Unidecode.NET --version 2.2.1
#r "nuget: Unidecode.NET, 2.2.1"
#:package Unidecode.NET@2.2.1
#addin nuget:?package=Unidecode.NET&version=2.2.1
#tool nuget:?package=Unidecode.NET&version=2.2.1
Unidecode.NET
Purpose
It often happens that you have text data in Unicode, but you need to represent it in ASCII. For example when integrating with legacy code that doesn’t support Unicode, or for ease of entry of non-Roman names on a US keyboard, or when constructing ASCII machine identifiers from human-readable Unicode strings that should still be somewhat intelligible (a popular example of this is when making an URL slug from an article title).
Overview
Unidecode is meant to be a transliterator of last resort, to be used once you've decided that you can't just display the Unicode data as is, and once you've decided you don't have a more clever, language-specific transliterator available or once you've already applied a smarter algorithm and now just want Unidecode to do cleanup.
In other words, when you don't like what Unidecode does, do it yourself. Really, that's what the above says. Here's how you would do this for German, for example:
In German, there's the typographical convention that an umlaut (the double-dots on: ä ö ü) can be written as an "-e", like with "Schön" becoming "Schoen". But Unidecode doesn't do that. Unidecode simply drop the umlaut accent and give back "Schon".
Example code
Take a look at the list of assertions:
Assert.Equal("Rabota s kirillitsei", "Работа с кириллицей".Unidecode());
Assert.Equal("aouoAOUO", "äöűőÄÖŨŐ".Unidecode());
Assert.Equal("Hello, World!", "Hello, World!".Unidecode());
Assert.Equal("'\"\r\n", "'\"\r\n".Unidecode());
Assert.Equal("CZSczs", "ČŽŠčžš".Unidecode());
Assert.Equal("a", "ア".Unidecode());
Assert.Equal("a", "α".Unidecode());
Assert.Equal("a", "а".Unidecode());
Assert.Equal("chateau", "ch\u00e2teau".Unidecode());
Assert.Equal("vinedos", "vi\u00f1edos".Unidecode());
Other implementations
- Text::Unidecode for Perl (the original implementation)
- Unidecode for Python
Credits
This project is a fork of the unidecodesharpfork written by Dima Stefantsov.
License
This project is licensed under MIT.
Character transliteration tables used in this project are converted from the tables provided in Unidecode for Python under the GPL-2.0 license which is port of the Perl library Text::Unidecode by Sean M. Burke and are distributed under the Perl license.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net7.0
- No dependencies.
NuGet packages (19)
Showing the top 5 NuGet packages that depend on Unidecode.NET:
Package | Downloads |
---|---|
Volo.CmsKit.Domain
Package Description |
|
ZhileTime.CmsKit.Domain
Package Description |
|
SluggyUnidecode
SluggyUnidecode is a powerful slugifier designed to create friendly URL's. Simple and powerful. Extends the Sluggy package by using the Unidecode.Net library for normalization. |
|
Dignite.Cms.Domain.Shared
Package Description |
|
SimplifiedSearch
Simple way to add ranked fuzzy matching search. For when you have up to a few thousand products, locations or similar and want to add a search that most users will see as smart, with minimal work. using SimplifiedSearch; IList<Country> matches = await listOfCountries.SimplifiedSearchAsync("thaiwan", x => x.CountryName); foreach (var country in matches) Console.WriteLine(country.CountryName); // output: // Taiwan // Thailand |
GitHub repositories (1)
Showing the top 1 popular GitHub repositories that depend on Unidecode.NET:
Repository | Stars |
---|---|
abpframework/abp
Open-source web application framework for ASP.NET Core! Offers an opinionated architecture to build enterprise software solutions with best practices on top of the .NET. Provides the fundamental infrastructure, cross-cutting-concern implementations, startup templates, application modules, UI themes, tooling and documentation.
|