Problems with accented characters in French
Problems with accented characters in French
First accented characters would simply no show in the browser, corrected that with adding a utf8_encode
FROM: $row[] = $aRow[ $aColumns[$i] ];
TO: $row[] = utf8_encode( $aRow[ $aColumns[$i] ]);
That solve the display problem but there was still a searching problem
Searching with a accented character would not bring back anything, searching with the same character non accented gave back occurence of both the accented and the not accented character
Searching for "e" brought back every instance of "e" AND "é" but searching for "é" brought back nothing
Finally the answer was in telling php that the link to be created with mysql had to be in UTF8
mysql_set_charset ("UTF8", $link_to_database);
Worked beautifully for the searching but weird characters on the display, so took away the utf8_encore and VOILÀ!!!!
So just adding: mysql_set_charset ("UTF8", $link_to_database); worked for me
Have fun! I did!
FROM: $row[] = $aRow[ $aColumns[$i] ];
TO: $row[] = utf8_encode( $aRow[ $aColumns[$i] ]);
That solve the display problem but there was still a searching problem
Searching with a accented character would not bring back anything, searching with the same character non accented gave back occurence of both the accented and the not accented character
Searching for "e" brought back every instance of "e" AND "é" but searching for "é" brought back nothing
Finally the answer was in telling php that the link to be created with mysql had to be in UTF8
mysql_set_charset ("UTF8", $link_to_database);
Worked beautifully for the searching but weird characters on the display, so took away the utf8_encore and VOILÀ!!!!
So just adding: mysql_set_charset ("UTF8", $link_to_database); worked for me
Have fun! I did!
This discussion has been closed.
Replies
Might be worth reconfiguring your MySQL / PHP install to do this by default in future?
Allan