Git Product home page Git Product logo

unidecode.net's Introduction

Unidecode.NET

Build status NuGet NuGet License MIT

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".

More information

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

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.

unidecode.net's People

Contributors

phnx47 avatar thecoderok avatar sloukidis avatar mathiasbaert avatar twirpx avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.