NYCPHP Meetup

NYPHP.org

[nycphp-talk] UTF-8, databases and best practices

Ronald Bradford ronald.bradford at gmail.com
Wed May 23 15:43:22 EDT 2012


 My Recommendations. I use this successfully in several multiple language
projects.

# my.cnf
[mysqld]
default_character_set = utf8
character_set_client       = utf8
character_set_server       = utf8
[client]
default_character_set = utf8

#php.ini
default_charset = "utf-8"

#httpd.conf
AddDefaultCharset UTF-8

<VirtualHost>
    AddCharset UTF-8   .htm
</VirtualHost>

MySQL connection  (extra precaution)
SET NAMES utf8;

HTML
  <meta charset="utf-8">

PHP
header('Content-type: text/html; charset=UTF-8');

And last but not least, even editing files in shell can be affected (.e.g
UTF-8 data to be inserted into DB from file).  Ensure

LC_CTYPE=en_US.UTF-8
LANG=en_US.UF-8

Regards

Ronald



01110010 01101111 01101110 01100001 01101100 01100100 00100000 01100010
01110010 01100001 01100100 01100110 01101111 01110010 01100100
*Ronald Bradford
*
MySQL Expert specializing in Performance Tuning, Scalability and High
Availability

Author - Effective MySQL: Optimizing SQL
Statements<http://effectivemysql.com/book/optimizing-sql-statements/>
-
2011,  Co-author - Expert PHP and MySQL <http://expertphpandmysql.com/> -
2010
All-time top MySQL Blogger -
2011<http://mysqlpreacher.com/wordpress/2011/01/mysql-community-blogging-%E2%80%93-planetmysql-part-2/>
, Oracle ACE Director -
2010<http://apex.oracle.com/pls/otn/f?p=19297:4:134763154226248::NO:4:P4_ID:1820>
,  MySQL Community Member of the Year -
2009<http://www.mysql.com/why-mysql/awards/community-2009.html>

Web Site: http://ronaldbradford.com
Linked In: http://www.linkedin.com/in/ronaldbradford
Twitter:     @RonaldBradford <http://twitter.com/ronaldbradford>,
@MySQLExpert <http://twitter.com/MySQLExpert>
Skype:     RonaldBradford
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20120523/ba0c3baf/attachment.html>


More information about the talk mailing list