Test SELECT:
MySQL [chuangwai]> select ar_detail from items limit 1\G;
*************************** 1. row ***************************
ar_detail: {"طراز": "فساتين قفطان", "المواد": "الشيفون"}
and you can see the Arabic characters displayed correctly.
Then I check encoding:
MySQL [chuangwai]> select * from information_schema.SCHEMATA\G;
*************************** 2. row ***************************
CATALOG_NAME: def
SCHEMA_NAME: chuangwai
DEFAULT_CHARACTER_SET_NAME: latin1
DEFAULT_COLLATION_NAME: latin1_swedish_ci
SQL_PATH: NULL
In another SO post, BalusC said:
If you're trying to store non-Latin characters like Chinese, Japanese, Hebrew, Cyrillic, etc using Latin1 encoding, then they will end up as mojibake.
As you see, it is not my case. Could anyone please give me an explanation why I can store Arabic characters with latin1
encoding? Is it necessary for us to switch the encoding of our DB from latin1
to uft8
?
EDIT: Okay, I just found the encoding of items
is uft8
...
MySQL [chuangwai]> SELECT TABLE_COLLATION
-> FROM INFORMATION_SCHEMA.TABLES
-> WHERE TABLE_NAME = 'items';
+-----------------+
| TABLE_COLLATION |
+-----------------+
| utf8_unicode_ci |
+-----------------+