Hi pihentagy ,

Thanks for your reply. I've tested both str_replace and
mb_ereg_replace, and still have strange result. All my files (php,
fixtures...) are UTF-8 encoded, so is the DB. I really don't get it!

Thanks again for your help
Guy

Here are my latests tries :

        static public function CleanDiacrText($text)
                {
                $text = strtr($text,
'ÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÒÓÔÕÖÙÚÛÜÝàáâãäåçèéêëìíîïðòóôõöùúûüýÿ',
'AAAAAACEEEEIIIIOOOOOUUUUYaaaaaaceeeeiiiioooooouuuuyy');
                return $text;
                }

        static public function mb_CleanString($str, $encoding = 'utf-8')
                {
            mb_regex_encoding($encoding);
            $pattern = array('À', 'Á', 'Â', 'Ã', 'Ä', 'Å', 'Ç', 'È', 'É',
'Ê', 'Ë', 'Ì', 'Í', 'Î', 'Ï', 'Ò', 'Ó', 'Ô', 'Õ', 'Ö', 'Ù', 'Ú', 'Û',
'Ü', 'Ý', 'à', 'á', 'â', 'ã', 'ä', 'å', 'ç', 'è', 'é', 'ê', 'ë', 'ì',
'í', 'î', 'ï', 'ð', 'ò', 'ó', 'ô', 'õ', 'ö', 'ù', 'ú', 'û', 'ü', 'ý',
'ÿ');
            $replacement = array('A', 'A', 'A', 'A', 'A', 'A', 'C', 'E', 'E',
'E', 'E', 'I', 'I', 'I', 'I', 'O', 'O', 'O', 'O', 'O', 'U', 'U', 'U',
'U', 'Y', 'a', 'a', 'a', 'a', 'a', 'a', 'c', 'e', 'e', 'e', 'e', 'i',
'i', 'i', 'i', 'o', 'o', 'o', 'o', 'o', 'o', 'u', 'u', 'u', 'u', 'y',
'y');
            for ($i=0; $i<sizeof($pattern); $i++)
                {
                $str = mb_ereg_replace($pattern[$i], $replacement[$i], $str);
                }
            return $str;
                }


On Feb 26, 6:12 am, pihentagy <[EMAIL PROTECTED]> wrote:
> So my suggestion is to use utf8 everywhere.
>
> BTW why don't you use str_replace? Using regex here might be an
> overkill. (who cares anyway, one regexp per post 
> :-P)http://www.php.net/manual/en/function.str-replace.php
>
> On Feb 24, 3:33 pm, "GuyMontréal" <[EMAIL PROTECTED]> wrote:
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to