Connection Character Sets and Collations
Hello to all,
i have some problems understanding how this "Character Sets and Collations" feature work.
in my tests i do the following:
#creating my test table:
CREATE TABLE `test`(
`id` int(10) unsigned NOT NULL auto_increment,
`text` varchar(255) character set utf8 collate utf8_general_ci NOT NULL default '',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 PACK_KEYS=0
#inserting some data => utf8 pre-encoded (Gerät => Gerät)
$sql = "INSERT INTO test SET text='Gerät'";
#Setting character_set variables:
$sql = "SET character_set_client = latin1";
$sql = "SET character_set_connection = utf8";
$sql = "SET character_set_results = latin1";
#try to select the data
$sql = "SELECT text FROM test WHERE text = 'Gerät'";
My opinion is that if I try to select some data the client send the query in 'latin1' to mysql. Mysql converts the data to 'utf8' and try to match it in the table 'test'. mysql sends the result back to the client in 'latin1'.
If that is right why my select statement (SELECT text FROM test WHERE text = 'Gerät') do not return any result?
Greetz from Berlin Germany
Tobias
Edited 2 time(s). Last edit at 09/13/2005 07:32AM by Tobias Haase.
Subject
Views
Written By
Posted
Connection Character Sets and Collations
2572
August 11, 2005 05:02AM
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.