I am having a problem with collation. I want to set collation to support the Japanese language. For example, when table.firstname has 'あ', a query with 'ぁ' should return the record. Thanks in advance.
3
-
1dev.mysql.com/doc/refman/5.7/en/faqs-cjk.html – Drew Aug 20 '16 at 2:56
-
1It can be defaulted to the db, table, or override at the column level – Drew Aug 20 '16 at 2:58
-
Check this – 1000111 Aug 20 '16 at 5:10
-
I don't think that this problem has anything to do with 'collation' !?! – Strawberry Aug 20 '16 at 8:55
-
Then share your thought process which might help the PO @stawberry – 1000111 Aug 20 '16 at 10:27
3
That's like "uppercase" and "lowercase", correct?
mysql> SELECT 'あ' = 'ぁ' COLLATE utf8_general_ci;
+---------------------------------------+
| 'あ' = 'ぁ' COLLATE utf8_general_ci |
+---------------------------------------+
| 0 |
+---------------------------------------+
mysql> SELECT 'あ' = 'ぁ' COLLATE utf8_unicode_ci;
+---------------------------------------+
| 'あ' = 'ぁ' COLLATE utf8_unicode_ci |
+---------------------------------------+
| 1 |
+---------------------------------------+
mysql> SELECT 'あ' = 'ぁ' COLLATE utf8_unicode_520_ci;
+-------------------------------------------+
| 'あ' = 'ぁ' COLLATE utf8_unicode_520_ci |
+-------------------------------------------+
| 1 |
+-------------------------------------------+
I recommend changing your column to be COLLATION utf8_unicode_520_ci
(or utf8mb4_unicode_520_ci
).
If you expect to be including Chinese, then be sure to use utf8mb4
. (Perhaps this advice applies to Kanji, too.)
-
thanks for answer, if possible 'あ' = 'ア', what collation or something. – Chung Do Aug 21 '16 at 13:37
-
Should a Hiragana A be treated as equal to a Katakana A?
...unicode_520_ci
does treat them equal. That is the best available in utf8/utf8mb4. SeeSHOW COLLATION LIKE '%jap%';
for what is available in other character sets. – Rick James Aug 21 '16 at 15:30