I am currently adapting a php/mysql photo gallery piece of software to put a php version of my herbarium on line. Since a number of strings will be in French, I am using utf8 throughout, but I am confronted with a tedious problem, which may have a simple solution.
1- My mysql database collation is utf8_general_ci.
2- The HTML output from php is set to
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />3- When I write to the database field a string which has French characters in it, in order to get it displayed correctly (e.g. when I view the database using phpMyAdmin), I use mysql_query("INSERT INTO etc."), but previously I use utf8_decode for all my strings.
4- When I retrieve data from the mysql database, before displaying it, I have to pass each string through an utf8_encode for correct display in the browser.
Why is that? Given points 1 and 2 I would expect not to have to use those utf8_decode/encode functions.
Any help appreciated,
Joseph