How to convert 'ö' to 'oe' or 'o' (or other similar things) in a string?

Martin Schöön martin.schoon at gmail.com
Sat Sep 17 16:20:12 EDT 2016


Den 2016-09-17 skrev Kouli <dev at kou.li>:
> Hello, try the Unidecode module - https://pypi.python.org/pypi/Unidecode.
>
> Kouli
>
> On Sat, Sep 17, 2016 at 6:12 PM, Peng Yu <pengyu.ut at gmail.com> wrote:
>> Hi, I want to convert strings in which the characters with accents
>> should be converted to the ones without accents. Here is my current
>> code.

Side note from Sweden. Å, ä and ö are not accented characters in our 
language. They are characters of their own. If you want to look up
someone called Öhman in the phone directory you go to the Ö section 
not the O section.

Related anecdote from Phoenix AZ. By now you have noticed my family
name: Schöön. On airline tickets and boarding passes in the U.S. it
gets spelled Schoeoen. This landed me in a special security check
once. After a while the youngish lady performing the search started
to look like 1+1 did not sum up to 2. She looked at my passport
and boarding pass again and asked why I was there with her. I pointed
at another young lady, the one that 'scrutinized' passports and
boarding passes while chatting with a friend and said "She told me
to go over here." "Wait here, I have to talk to my supervisor."

A few minutes passed (I was alone in the enhances security check
throughout...) and then "I am sorry but you should not have had
to go through here. There was a mistake."

So there you are: If you are a middle aged, caucasian guy with
a passport from northern Europe and no 'funny' letters in your name
your are not a threat in the eyes of TSA in Arizona.

Sorry for wasting the bandwidth.

/Martin



More information about the Python-list mailing list