views:

525

answers:

2

Hello,

How do I make a diacritic insensitive,

ex this persian string with diacritics

هواى بَر آفتابِ بارِز

is not the same as with removed diacritics in mySql

هواى بر آفتاب بارز

Is there a way of telling mysql to ignore the diacritics or do I have to remove all the diacritics in my fields manually?

A: 

It's a bit like case-insensitivity problem.

SELECT * FROM blah WHERE UPPER(foo) = "THOMAS"

Just convert both strings to diacritic-free before comparing.

Artelius
(Not sure how to remove diacritics in SQL, perhaps someone else can help?)
Artelius
Actually it's a little more complex than case-sensitivity or insensitivity. Unless a software includes support for specific scripts (which MySQL doesn't seem to have for Persian) you're out of luck. Or you're in for some work writing a custom function to do it for you; won't be pretty either way.
Joey
A: 

Did you already read all of MySQL Character Set Support to check if the answer to your question isn't already there? Especially collations are to be understood.

I wild guess is that using utf8_general_ci could do the right thing for you

jitter
http://dev.mysql.com/doc/refman/5.0/en/charset-unicode-sets.html has a comment at the very bottom which addresses a similar issue for Hebrew, noting that MySQL has problems regardless which collation is used, though different problems. The issue for Persian might be similar.
Joey