I am displaying state names from the db. one of the state name is "Québec", it has a link which says "/state/Québec/", it should say "/state/Quebec". I tried all the functions, all my best , but i don't knnow why its not converting. i used : 1) str_replace("é","e",$string) 2) got a function, remove accented chars return strtr($string, "ŠŒŽšœžŸ¥µÀÃÂÃÄÅÆÇÈÉÊËÌÃÃŽÃÃÑÒÓÔÕÖØÙÚÛÜÃßà áâãäåæçèéêëìÃîïðñòóôõöøùúûüýÿ","SOZsozYYuAAAAAAACEEEEIIIIDNOOOOOOUUUUYsaaaaaaaceeeeiiiionoooooouuuuyy"); when i compare the string $string=="Québec", it returns false, but the when i echo the string it says Québec, i am tooooooo confused. i dono which way to move now ? any help pleaseeeeee
Hi, there could be conflict with encoding of your database records with the format of your PHP file. Are they both the same? Because on plain PHP file, encoded in ANSI it works. But as soon as your string is ISO something and your PHP file is UTF-8, it doesn't translate the characters right. You may check that or apply iconv() prior to strtr()...
in database it is written as 'Québec' Also, i echoed the encoding of the string using mb_detect_encoding and it gave me UTF-8 how to use iconv() function ??
Ok, and what if you use the function from here? Does it do anything? I see you have some few characters more, but you can easily expand it.
Ok, then I'm pretty sure there's encoding problem of your PHP file with encoding in your DB. Check what is encoding of your column (that stores 'Quebec') in DB. As you said it should be utf-8 (probably utf-8 general). Then check that your PHP function/class for DB connection sets proper encoding - e.g. mysql_query("SET NAMES 'utf8'"); after you connect and select DB. Then copy once again the function from PHP manual or the one you have, and ensure you save the PHP file as utf-8. After that you should get it. Let us know...