Problem selecting data with letter 'à'
Posted by: Matteo Filisetti
Date: November 09, 2009 11:19AM

Hi all,
I have a problem selecting data with text that contains the 'à' char.

I've created a new database:
create database my_database;

Then I've created a new table with a simple field like this:
create table test (field1 char(30) character set utf8 collate utf8_general_ci);
As you can see the character set is UTF-8.

I've inserted a new record:
insert into test values ('à');

I've checked that it was a real utf8 character with this query:
select hex(field1) from test;
and the result was correctly 'C3A0'.
Even with this query the result is correct:
select hex('à') from test;

Now, my problem is this.
If I execute this statement all works fine:
select * from test where hex(field1) = hex('a');
but if I launch this one without the "hex" function:
select * from test where field1 = 'a';
it returns the record and I don't want it: why MySql do this?

I'm using PhpMyAdmin...


Thanks, regards.

Matteo

Options: ReplyQuote


Subject
Views
Written By
Posted
Problem selecting data with letter 'à'
3586
November 09, 2009 11:19AM


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.