Jump to content

Removing french accent


FadeOut79

Recommended Posts

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

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???

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.