Vahid Ghafarpour's Blog

نكات جالب از نظر وحيد غفارپور!

Wednesday, February 21, 2007

PHP MySQL connection collation

To change the connection charset permanently to UTF-8, add the following line in the [mysqld] section:
[mysqld]
init-connect='SET NAMES utf8'

The other way to let MySQL know what connection charset you intend to use is per-connection based. After a connection is established (with host, name, password), add the following two lines in your application:
SET NAMES utf8;
SET CHARACTER_SET utf8;

Labels: ,

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home