Re: Converting accented characters or numeric equivalents to non-accented
| From: | Paul Roberts | Date: | Sat, 18 Jan 2003 19:13:02 +0000 |
| Subject: | Re: Converting accented characters or numeric equivalents to non-accented | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-132118@lists.php.net to get a copy of this message | ||
another one for you
function removeaccents($string) {
return strtr($string,
"SOZsozY¥µÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýÿ",
"SOZsozYYuAAAAAAACEEEEIIIIDNOOOOOOUUUUYsaaaaaaaceeeeiiiionoooooouuuuyy");
}
Best Wishes & Happy New Year
Paul Roberts
mail@paul-roberts.com
++++++++++++++++++++++++
----- Original Message -----
From: "Ian M. Evans" <ianevans@digitalhit.com>
To: "Ernest E Vogelsinger" <ernest@vogelsinger.at>;
<php-general@lists.php.net>
Sent: Saturday, January 18, 2003 6:41 PM
Subject: RE: [PHP] Converting accented characters or numeric equivalents to non-accented
Ernest E. Vogelsinger suggested:
>$chars_in = array('Á',''á','É','é'); // you
>get it
>$chars_out = array('A','a','E','e'); // this too
>preg_replace($chars_in, $chars_out, $string_to_parse);
I initially got a 'no ending delimiter' error but after adding /'s to the
$chars_in it was just what the doctor ordered.
I'm actually a little surprised that there isn't a built-in function, say,
strip_accent(). I'd assume a lot of people would need this at some time or
another.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php