mercredi 28 octobre 2015

Vietnameses Unicode text in SQLite

I know that this question was asked in this site, but all of answers didn't solved the problem. So I ask again my problem here.

I created a sqlite db (via Firefox Sqlite manager tool), and the data is stored with Vietnamese.

CREATE TABLE "customer" ("cus_id" TEXT, "cus_name" TEXT, "cus_address" TEXT, "cus_phone" TEXT);

INSERT INTO "customer" VALUES('KH1','Trần Văn A','Hai Bà Trưng, quận 1','0908112233');
INSERT INTO "customer" VALUES('KH2','Lê Hoài B','Hai Bà Trưng, quận 1','0908112233');
INSERT INTO "customer" VALUES('KH3','Nguyễn Thành C','Hai Bà Trưng, quận 1','0908112233');

And my app is iOS app. User search text "Tran" I tried the query:

SELECT * FROM customer WHERE cus_name LIKE '%Tran%';

I tried another solution:

SELECT * FROM customer WHERE cus_name COLLATE UTF8CI LIKE '%Tran%';

But I got 0 record. And then I have tried more solutions which I found on internet but I got 0 record too.

Please help. Thank you.

Aucun commentaire:

Enregistrer un commentaire