MySQL Forums
Forum List  »  PHP

Re: Charset SESSION vs GLOBAL
Posted by: Cédric Michel
Date: March 27, 2011 01:05PM

thanks for advice

CREATE TABLE `evenement` (
  `titre` varchar(255) NOT NULL default '',
  ...
) ENGINE=MyISAM AUTO_INCREMENT=2513 DEFAULT CHARSET=latin1

SELECT titre, HEX(titre), LENGTH(titre), CHAR_LENGTH(titre)...
testé | 74657374E9 | 5 | 5

It seems that data is correctly encoded ?

Rick James Wrote:
-------------------------------------------------------
> SET NAMES (and 'char%') relate to whether the
> bytes are transcoded on the way in/out of the server.

-------------------------------------------------------

It seems there is no way to setup connection charset (no config file) with PHP...?! Does it mean that php will always crush the global configuration? Is it really necessary to recompile?
I'll try to look at this file (php_mysql.c), but that would be very surprising that there is no configuration file for mysql_connect with PHP(?)!

php.net / mysql-client-encoding (64827):
-------------------------------------------------------
Unfortuantely the PHP mysql_connect() function does not use MySQL options files so this is not a sollution for changing the default connection character set for mysqlclient library v4.1+.
The only working sollution remains:
mysql_query("SET NAMES utf8", $conn);
(of course /ext/mysql/php_mysql.c can always be patched ;] )

-------------------------------------------------------

Cédric Michel
Site internet

Options: ReplyQuote


Subject
Written By
Posted
March 26, 2011 03:37PM
Re: Charset SESSION vs GLOBAL
March 27, 2011 01:05PM
March 27, 2011 07:17PM
March 28, 2011 12:26AM


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.