Search code examples
pythontype-conversionasciiextended-ascii

Extended ASCII Character Conversion


How can I convert Extended ASCII characters such as: "æ, ö or ç" into non-extended ASCII characters (a,o,c) using python? The way it works should be that if it takes "A, Æ ,Ä" as input, It returns A for all of them.


Solution

  • Unidecode might be of use to you.

    Python 3.2.3 (default, Jun  8 2012, 05:36:09) 
    [GCC 4.7.0 20120507 (Red Hat 4.7.0-5)] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> from unidecode import unidecode
    >>> unidecode("æ, ö or ç")
    'ae, o or c'