FadeOut79 Posted March 24, 2008 Share Posted March 24, 2008 Hi everybody, I have some problem removing french accent from a dbase database to convert to a mysql database.... I have a script to transfer records from my dbase db to mysql, and in this script i have a function to remove almost every accent in strings from the dbase db It works almost perfectly except for É (the one that repeats the most) here is the function function parse_string($astring) { $spcChars = explode( '|', 'À|Á|Â|Ã|Ä|Å|à|á|â|ã|ä|å|Ò|Ó|Ô|Õ|Ö|Ø|ò|ó|ô|õ|ö|ø|È|É|Ê|Ë|è|é|ê|ë|Ç|ç|Ì|Í|Î|Ï|ì|í|î|ï|Ù|Ú|Û|Ü|ù|ú|û|ü|ÿ|Ñ|ñ'); $repChars = explode( '|', 'A|A|A|A|A|A|a|a|a|a|a|a|O|O|O|O|O|O|o|o|o|o|o|o|E|E|E|E|e|e|e|e|C|c|I|I|I|I|i|i|i|i|U|U|U|U|u|u|u|u|y|N|n'); // $tstring = utf8_encode($astring); --- tryed this, does not work at all $tstring = str_replace($spcChars,$repChars, $astring) ; $tstring = addslashes(trim($tstring)); // strtr($astring, "ÀÁÂÃÄÅàáâãäåÒÓÔÕÖØòóôõöøÈÉÊËèéêëÇçÌÍÎÏìíîïÙÚÛÜùúûüÿÑñ", "AAAAAAaaaaaaOOOOOOooooooEEEEeeeeCcIIIIiiiiUUUUuuuuyNn"); --- tryed this one too, but there is errors in replacement and leave the É with a square character return $tstring; } thanx Link to comment https://forums.phpfreaks.com/topic/97623-removing-french-accent/ Share on other sites More sharing options...
effigy Posted March 24, 2008 Share Posted March 24, 2008 What character set is the data currently stored in? Why not retain the accents? Link to comment https://forums.phpfreaks.com/topic/97623-removing-french-accent/#findComment-499501 Share on other sites More sharing options...
FadeOut79 Posted March 24, 2008 Author Share Posted March 24, 2008 i think you find the problem, the mysql db is in iso-8859-1 and the pages in utf-8 I'll try some changes, and get back to you if the problem persist.... thanx for the quick reply Link to comment https://forums.phpfreaks.com/topic/97623-removing-french-accent/#findComment-499505 Share on other sites More sharing options...
effigy Posted March 24, 2008 Share Posted March 24, 2008 If you still want to remove the accents, see this post. Link to comment https://forums.phpfreaks.com/topic/97623-removing-french-accent/#findComment-499513 Share on other sites More sharing options...
FadeOut79 Posted March 24, 2008 Author Share Posted March 24, 2008 I've looked in my documents, remove the part where the accents are removed, replaced the charset from utf-8 to iso-8859-1 but still no result... Now that i've got the charset iso-8859-1, the é does not appears correctly neither.... Did I forget something here??? Link to comment https://forums.phpfreaks.com/topic/97623-removing-french-accent/#findComment-499585 Share on other sites More sharing options...
effigy Posted March 24, 2008 Share Posted March 24, 2008 What? Did you try the link I provided? Link to comment https://forums.phpfreaks.com/topic/97623-removing-french-accent/#findComment-499598 Share on other sites More sharing options...
FadeOut79 Posted March 24, 2008 Author Share Posted March 24, 2008 Yeah, i've looked the link you provided. But as you said earlier, I try to keep those accent... Link to comment https://forums.phpfreaks.com/topic/97623-removing-french-accent/#findComment-499614 Share on other sites More sharing options...
effigy Posted March 24, 2008 Share Posted March 24, 2008 I would convert everything to UTF-8. Have you tried that route? Link to comment https://forums.phpfreaks.com/topic/97623-removing-french-accent/#findComment-499620 Share on other sites More sharing options...
FadeOut79 Posted March 24, 2008 Author Share Posted March 24, 2008 not really, is it possible even if i cannot modify the php server settings... ?? Or can i change those settings even if I don't own the server... I'm not very familiar with this Link to comment https://forums.phpfreaks.com/topic/97623-removing-french-accent/#findComment-499658 Share on other sites More sharing options...
effigy Posted March 24, 2008 Share Posted March 24, 2008 You should be able to control the character set of your table: Docs Link to comment https://forums.phpfreaks.com/topic/97623-removing-french-accent/#findComment-499778 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.