Forum Moderators: coopster

Message Too Old, No Replies

Removing umlauts from PHP

         

Lisa

6:21 pm on Sep 10, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I need to clean all non a-z characters. Like if I find a "U" with those two dots above it I want to clean it to just a "U". I remember seeing this function somewhere but I can't locate it.

jatar_k

6:44 pm on Sep 10, 2002 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



there's string translate but you have to feed it the array of chars/replacements.

[php.net...]

if you are using it for html you could use something like htmlentities, doesn't do exactly what you want but might be an option depending on what you are doing.

[php.net...]

ergophobe

7:15 pm on Sep 10, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Lisa,

I do this for a script that takes user input and creates directories. Like Jatar says, use strtr, but you don't have to use an array, just

$cat_dir = strtr($cat_dir,
"ÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïðòóôõöøùúûüýÿÑñ",
"AAAAAACEEEEIIIIOOOOOOUUUUYaaaaaaceeeeiiiiooooooouuuuyyNn");

This should pretty much take any alpha in the ISO-8859-1 and translate it to ASCII (you have to take further steps or add more for non-alpha, of course)

Tom

NameNick

10:33 am on Sep 18, 2002 (gmt 0)

10+ Year Member



Hi Lisa,

if you want to do german users/visitors a favour replace the german two-dot-characters (ä, ü, ö, Ä, Ü, Ö) with the character without the dots plus an 'e'.

Ä = Ae
Ö = Oe
Ü = Ue
ä = ae
ö = oe
ü = ue

The meaning and the pronunciation is known and especialy in e-mail communicationen these characters are often used here.

Greetings NN