Re: utf8 charset comunication PHP5 -> MySQL4.1 IMPOSSIBLE!
Posted by: Shuichi Tamagawa
Date: September 09, 2005 02:56PM

Hi

> I have changed EVERYTHING to utf-8 charset:

<cut>

> [mysql]
>default-character-set=utf8

</cut>

This works only for 'mysql' command line client in bin directory, and does not work for the client library that your PHP program use.

Check the result of 'SHOW VARIABLES LIKE 'char%' from your program. The value of the client character set variables such as:

character_set_client
character_set_connection
character_set_results

would be 'latin1' because the default character set of the client library is 'latin1' unless you compile it from source using '--with-charset=character_set_name'.

To change the character set of the client library, you can do one of the followings:

1. execute 'SET NAMES utf8' everytime after connecting to the database
2. add init_connect='SET NAMES utf8' in [mysqld] part of my.cnf
3. compile mysql from source using --with-charset=utf8 and have your PHP to use the client library.

Hope it helps.

Regards,

Shu

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: utf8 charset comunication PHP5 -> MySQL4.1 IMPOSSIBLE!
4628
September 09, 2005 02:56PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.