Special HTML characters in Python to ASCII
Question: I want to convert special characters which I see during web-page reading to
the ASCII format. I've tried a lot, but I can't figure it out. I will give
some examples below which are stored in a string in Python.I don't know what
the current encoding of the web-page is, but I want to convert it to ASCII
format.

    
    
    ApaydÄ±n Ãœnal > want this to Apaydin Unal
    Íñigo Martínez > want this to Inigo Martinez
    ÃœstÃ¼nel > want this to Ustunel
    

Who can help me?

EDIT: Thanks, I forgot. I'm using Python 2.7


Answer: Give <https://pypi.python.org/pypi/Unidecode> a try:

    
    
    >>> from unidecode import unidecode
    >>> unidecode(u'ko\u017eu\u0161\u010dek')
    'kozuscek'
    

And to detect the encoding, see the question [Python: Is there a way to
determine the encoding of text
file?](http://stackoverflow.com/questions/436220/python-is-there-a-way-to-
determine-the-encoding-of-text-file)

