Re: UTF8 Chinese String Comparison
Posted by: CL Chuah
Date: September 28, 2009 03:41PM

Hi Rick,
U r indeed an expert! Like what u suspected, the input is 'contaminated', i only found out when i use HEX() function that u suggested. And yes, the records are double encoded.

So the lesson is: "SET NAMES utf8" is a MUST right from the beginning when the records are inserted.

For the benefit of those hitting the same problems, here are simple flows:
SET NAMES utf8; -- Don't forget this
insert into test_utf (a) values ('飞');
insert into test_utf (a) values ('裎');

And when u retrieve records,
SET NAMES utf8; -- Again, Don't forget this
select * from test_utf where a='裎';
> The server returns what I wanted '裎'

Thanks again!



Edited 1 time(s). Last edit at 09/28/2009 03:51PM by CL Chuah.

Options: ReplyQuote


Subject
Views
Written By
Posted
10366
September 25, 2009 01:38PM
3592
September 26, 2009 05:48PM
3252
September 27, 2009 12:37PM
4463
September 27, 2009 05:44PM
Re: UTF8 Chinese String Comparison
3499
September 28, 2009 03:41PM
3727
September 28, 2009 03:49PM
3225
September 28, 2009 11:41PM


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.