user711372
user711372

Reputation: 89

Multilingual issue with wysywyg editors

I am using tinymce for my posts in the system and getting problem with accented charachters, now here is what happened on my side.

If I type french accented character lets say à my tiny mce converts it into à but I really do need to save this character à in my database rather than saving à.

I have also tried with ckEditor but the problem is same.

Can anyone tell me how to overcome this problem as I am on tight deadline and its really becoming a headache, it will be great if anyone can help.

Upvotes: 1

Views: 430

Answers (2)

user711372
user711372

Reputation: 89

ok I have solved it using php french accents array. Following function I have created.

    function replaceAccents($content)
    {
        //French Accent Array
        $arrFrenchAccent=array('À'=>'À', 'à'=>'à', 'Á'=>'Á', 'á'=>'á', 'Â'=>'Â', 'â'=>'â', 'Ã'=>'Ã', 'ã'=>'ã', 'Ä'=>'Ä', 'ä'=>'ä', 'Å'=>'Å', 'å'=>'å', 'Æ'=>'Æ', 'æ'=>'æ', 'Ç'=>'Ç', 'ç'=>'ç', 'Ð'=>'Ð', 'ð'=>'ð', 'È'=>'È', 'è'=>'è', 'É'=>'É', 'é'=>'é', 'Ê'=>'Ê', 'ê'=>'ê', 'Ë'=>'Ë', 'ë'=>'ë', 'Ì'=>'Ì', 'ì'=>'ì', 'Í'=>'Í', 'í'=>'í', 'Î'=>'Î', 'î'=>'î', 'Ï'=>'Ï', 'ï'=>'ï', 'Ñ'=>'Ñ', 'ñ'=>'ñ', 'Ò'=>'Ò', 'ò'=>'ò', 'Ó'=>'Ó', 'ó'=>'ó', 'Ô'=>'Ô', 'ô'=>'ô', 'Õ'=>'Õ', 'õ'=>'õ', 'Ö'=>'Ö', 'ö'=>'ö', 'Ø'=>'Ø', 'ø'=>'ø', 'Œ'=>'Œ', 'œ'=>'œ', 'ß'=>'ß', 'Þ'=>'Þ', 'þ'=>'þ', 'Ù'=>'Ù', 'ù'=>'ù', 'Ú'=>'Ú', 'ú'=>'ú', 'Û'=>'Û', 'û'=>'û', 'Ü'=>'Ü', 'ü'=>'ü', 'Ý'=>'Ý', 'ý'=>'ý', 'Ÿ'=>'Ÿ', 'ÿ'=>'ÿ');     

        //Fliping arrays(keys and values) removing indexes using array_values.
        $originalFrench =   array_values(array_flip($arrFrenchAccent));
        //removing indexes using array_values.
        $arrFrenchAccent    =   array_values($arrFrenchAccent);
        //replacing e.g À with À within the content
        $content    =   utf8_encode(str_replace($arrFrenchAccent,$originalFrench,$content));
        return $content;
    }

I hope it will help anyone who gets the same problem.

Regards, Mustafa

Upvotes: 1

Thariama
Thariama

Reputation: 50832

Check the tinymce parameter entity_encoding.

Upvotes: 0

Related Questions