1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
|
function car_html($txt)
{
$txt = trim($txt);
// Lettres accentuées
$txt = str_replace(
array('à', 'À', 'ç', 'Ç', 'é', 'É', 'è', 'È', 'ê', 'Ê', 'ë', 'Ë', 'î', 'Î', 'ï', 'Ï', 'ô', 'Ô', 'ö', 'Ö', 'ù', 'Ù', 'û', 'Û', 'ü', 'Ü', 'oe', '°', '«', '»'),
array('à', 'À', 'ç', 'Ç', 'é', 'É', 'è', 'È', 'ê', 'Ê', 'ë', 'Ë', 'î', 'Î', 'ï', 'Ï', 'ô', 'Ô', 'ö', 'Ö', 'ù', 'Ù', 'û', 'Û', 'ü', 'Ü', '&oelig', '°', '«', '»'),
$txt)
;
// Ponctuation et divers symboles
$txt = str_replace(array('&', '"', "'", '<', '>', '«', '»'),
array('&', '"', ''', '<', '>', '«', '»'),
$txt
);
// Symboles mathématiques
$txt = str_replace(array('%', '1/2', '1/4', '3/4', '+/-'),
array('¢', '½', '¼', '¾', '±'),
$txt
);
return $txt;
} |
Partager