Blog
UTF-8 in a Web application (back-end)
2007-07-29 13:29:56 by Martynas Jusevičius
Following the post about UTF-8 in the front-end of a Web application, these are some points to check in the back-end:
- Again, make sure your application source and data files are UTF-8
- Make sure the character set of the database is set to UTF-8
- Make sure the character set of the connection to the database is set to UTF-8. With Propel and MySQL, it's done like this:
Although MySQL reference on character sets says the last 3 statements are redundant, we experienced that it is not true. It is however more likely an issue with Propel/Creole, not MySQL.$con = Propel::getConnection(); $con->executeQuery("SET NAMES utf8;"); $con->executeQuery("SET CHARACTER SET utf8;"); $con->executeQuery('SET character_set_client="utf8"'); $con->executeQuery('SET character_set_connection="utf8"'); $con->executeQuery('SET character_set_results="utf8"'); - Make sure the PHP functionality you are using handles UTF-8 correctly (it is not supported natively). Check the list of UTF-8 “Dangerous” PHP Functionality.
