PHP: Funktion um Sonderzeichen / Umlaute zu mappen

13. April 2011 at 11:48

Mit der folgenden Funktion könnt ihr Sonderzeichen bzw. Ausländische Buchstaben (ISO8859-1 & ISO8859-2) in  deutschen Standard-Buchstaben konvertieren.

Mapping of special characters (ISO8859-1 & ISO8859-2) to German standard characters.

function _char_mapping($string)
 {
 $table = array(
 'À'=>'A',
 'Á'=>'A',
 'Â'=>'A',
 'Ã'=>'A',
 'Å'=>'A',
 'Æ'=>'A',
 'Ç'=>'C',
 'È'=>'E',
 'É'=>'E',
 'Ê'=>'E',
 'Ì'=>'I',
 'Î'=>'I',
 'Ï'=>'I',
 'Ð'=>'D',
 'Ñ'=>'N',
 'Ò'=>'O',
 'Ó'=>'O',
 'Ô'=>'O',
 'Õ'=>'O',
 '×'=>'x',
 'Ø'=>'OE',
 'Ù'=>'U',
 'Ú'=>'U',
 'Û'=>'U',
 'Ý'=>'Y',
 'à'=>'a',
 'á'=>'a',
 'â'=>'a',
 'ã'=>'a',
 'å'=>'o',
 'æ'=>'a',
 'ç'=>'c',
 'è'=>'e',
 'é'=>'e',
 'ê'=>'e',
 'ë'=>'e',
 'ì'=>'i',
 'í'=>'i',
 'î'=>'i',
 'ï'=>'i',
 'ð'=>'d',
 'ñ'=>'n',
 'ò'=>'o',
 'ó'=>'o',
 'ô'=>'o',
 'õ'=>'o',
 'ø'=>'oe',
 'ù'=>'u',
 'ú'=>'u',
 'û'=>'u',
 'ý'=>'y',
 'ÿ'=>'y',
 'A'=>'A',
 'L'=>'L',
 'L'=>'L',
 'S'=>'S',
 'Š'=>'S',
 'S'=>'S',
 'T'=>'T',
 'Z'=>'Z',
 'Ž'=>'Z',
 'Z'=>'Z',
 'a'=>'a',
 'l'=>'I',
 'l'=>'I',
 's'=>'s',
 'š'=>'s',
 's'=>'s',
 't'=>'t',
 'z'=>'z',
 'ž'=>'z',
 'z'=>'z',
 'R'=>'R',
 'Á'=>'A',
 'Â'=>'A',
 'A'=>'A',
 'L'=>'L',
 'C'=>'C',
 'Ç'=>'C',
 'C'=>'C',
 'É'=>'E',
 'E'=>'E',
 'Ë'=>'E',
 'E'=>'E',
 'Í'=>'I',
 'Î'=>'I',
 'D'=>'D',
 'Ð'=>'D',
 'N'=>'N',
 'N'=>'N',
 'R'=>'R',
 'U'=>'U',
 'Ô'=>'O',
 'O'=>'O',
 'r'=>'r',
 'd'=>'d',
 'u'=>'u',
 'e'=>'e'
 );
 return strtr($string, $table);
 }

 

 

GD Star Rating
loading...
GD Star Rating
loading...
PHP: Funktion um Sonderzeichen / Umlaute zu mappen, 10.0 out of 10 based on 1 rating