SV: [PHP-DB] Accents! Pls help. Still very confused.
| From: | Henrik Hornemann | Date: | Thu, 24 Feb 2005 10:08:15 +0000 |
| Subject: | SV: [PHP-DB] Accents! Pls help. Still very confused. | ||
| Groups: | php.db php.general | ||
| Request: | Send a blank email to php-db+get-38653@lists.php.net to get a copy of this message | ||
Hi,
It is not quite clear what you want to do. You can translate UTF-8 characters into html characters
like this:
$str = htmlentities($str,ENT_NOQUOTES,'UTF-8');
Or you can translate them in a costumizesd way with strtr()
For instance:
$translation = array(
"Ã¥" => "å", "ø" => "ø", "ä"
=> "ä", "ü" => "ü", "à " => "à",
"æ" => "æ", 'è' => "è", "é"
=> "é", "ù" => "ù", "ñ" => "ñ",
"Ã" => "í", "É" => "É",
"Ø" => "Ø", "ó" => "ó", "ç" =>
"ç",
"Ã…" => "Å", "û" => "û",
"ö" => "ö", "ü" => "ü", "ð" =>
"ð",
"ú" => "ú", "á" =>
"á", "â" => "â"
);
$str = strtr($str, $translation);
Both methods are simpler and a lot faster than regexps.
Hth Henrik Hornemann
-----Oprindelig meddelelse-----
Fra: mario [mailto:chiari.hm@flashnet.it]
Sendt: 23. februar 2005 19:34
Til: php-general@lists.php.net; php-db@lists.php.net
Cc: Burhan Khalid; Guillermo Rauch
Emne: [PHP-DB] Accents! Pls help. Still very confused.
Hello,
I am still very puzzled.
If you a couple of minutes of spare time, pls give a look at http://www.chiari.org/help/ and suggest a way out.
Thanks a lot.
mario
--
PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php