Strange issue with "=" and "like"
Posted by: Sindre Aarsaether
Date: March 05, 2007 10:21AM

Hi. I have a database (utf8) with a strange issue when handling special characters (as the norwegian letters æ ø å).

I have a table 'tags', with a field 'tag'. If the field-value is "østfold", then I can find the tag using:

mysql> SELECT * FROM tags WHERE tag = "østfold";
+-----+----------+-------+
| id | tag | cnt |
+-----+----------+-------+
| 293 | østfold | 23134 |
+-----+----------+-------+
1 row in set (0.00 sec)

But using like gives no hits (the same goes for "østfol%"):

mysql> SELECT * FROM tags WHERE tag like "østfold";
Empty set (0.00 sec)

For shorter words, this does not seem to be the case (word "øst"):

USING = :
mysql> SELECT * FROM tags WHERE tag = "øst";
+------+------+-----+
| id | tag | cnt |
+------+------+-----+
| 3855 | øst | 326 |
+------+------+-----+
1 row in set (0.01 sec)

USING like :
mysql> SELECT * FROM tags WHERE tag like "øst";
+------+------+-----+
| id | tag | cnt |
+------+------+-----+
| 3855 | øst | 326 |
+------+------+-----+
1 row in set (0.00 sec)


Any help would be greatly appreciated. I have been trying to solve this problem for ages.

Thanks!

Options: ReplyQuote


Subject
Views
Written By
Posted
Strange issue with "=" and "like"
2388
March 05, 2007 10:21AM


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.