1

Hey guys i got an interesting situation!

In Turkish language we have ı,ç,ğ,ö,ş and uppercase of them. I also have a huge table of threads with turkish titles.

like in this example :

mysql> select id,title from xr_threads where title = 'birinci';
+--------+---------+
| id     | title   |
+--------+---------+
|     67 | birinci |
|  34635 | bırıncı |
| 322727 | birinçi |
+--------+---------+
3 rows in set

Query in my function always grabs the first one. However if I run this query again with title = 'bırıncı' mysql grabs these 3 results again. I want mysql to only get 34635 id but no matter what I typed it always gets these 3 result. Why it is not getting the matched one?

T. Cem Yılmaz
  • 500
  • 9
  • 30
  • 2
    see this question - http://stackoverflow.com/questions/6552950/mysql-matching-unicode-characters-with-ascii-version – dotbill Feb 14 '13 at 00:35
  • 3
    possible duplicate of [SQL - how to return exact matches only (special characters)](http://stackoverflow.com/questions/8391169/sql-how-to-return-exact-matches-only-special-characters) – Lawrence Cherone Feb 14 '13 at 00:36

1 Answers1

1

Try:

mysql> select id,title from xr_threads where title = BINARY 'birinci';

More info about the BINARY operator use on the MySQL doc page http://dev.mysql.com/doc/refman/5.0/en/charset-binary-op.html

Tigger
  • 8,980
  • 5
  • 36
  • 40
  • works like a charm. is this 'BINARY' equivalent to collation = utf8_bin ? – T. Cem Yılmaz Feb 14 '13 at 00:44
  • As far as I know, 'binary' will cast the the following string to the binary version based on what your database is set to. So, yes, if your DB is utf8_bin. – Tigger Feb 14 '13 at 00:49