Aug. 18th, 2005 02:00 by — Permalink | TrackBack: http://deluca.biz/trackback/229 | Del.icio.us — exists for 6 years & 9 months ago — Rate:
I have recently upgraded my mySql server from 4.0 to 4.1; And, consequently, I was suprised to see that all the texts that used to work as UTF-8 were no longer displayed correctly. This was as much as a surprised than the utf support in mySql 4.1 was far better than what was know before.
I did suspect my migration process. But looking into details, with phpMyAdmin 2.6, I saw that my settings was ok: everything setup to utf-8 encoding.
Then I have tried to find something related to that on sites and forums. Espacially on mySql web site.
Did I find a solution? I give you the answer: You have to change the PHP code that peforms the connection to the server. You have to tell that you want UTF-8 names; here is the code:
$linkcommon = mysql_connect($dbhost, $dbuser, $dbpassword);
if ( ! $linkcommon )
die ( "Unable to connect to the shared db server: ".mysql_error() );
mysql_select_db ( $dbcommonname, $linkcommon )
or die ( "Unable to select shared db '$dbcommonname': ".mysql_error() );
Aug. 18th, 2005 02:00 by sdeluca — Permalink | TrackBack: http://deluca.biz/trackback/224 | Del.icio.us — exists for 6 years & 9 months ago — Rate:
— — Sorry, this content is not available in english.
A l'occasion de l'upgrade de MySql pour ce site de la version 4.0 à 4.1, quelle ne fût pas ma surprise que de constater que tous les textes contenant des caractères non us ascii étaient incorrectementspris en charge. Et ce, malgré le support avancé de UTF-8 par cette version.
J'ai tout de suite suspecté ma procédure de migration. Mais en examinant le contenu des tables à l'aide de phpMyAdmin 2.6, les encodings ainsi que les interclassements étant correctement positionnés (resp. utf-8 et utf-8–general–ci), je ne comprenait pas pourquoi, là, l'affichage était correct.
J'ai donc entrepris une recherche longue et pénible sur les sites et forums. Et surtout le site MySql.
Ai-je trouvé la solution ? Allez, je ne vous fais plus attendre: il faut intervenir sur votre code PHP de connection aux bases, il faut encore indiquer à mySql de gérer les noms en utf-8; Voilà le code:
$linkcommon = mysql_connect($dbhost, $dbuser, $dbpassword);
if ( ! $linkcommon )
die ( "Unable to connect to the shared db server: ".mysql_error() );
mysql_select_db ( $dbcommonname, $linkcommon )
or die ( "Unable to select shared db '$dbcommonname': ".mysql_error() );