Amar Gaikwad Amar Gaikwad - 1 month ago 4
MySQL Question

how to change font in mysql database to store unicode charactors

I want to store Unicode characters in mysql database what should i do.
I tried using charset settings but not working. please tell me some procedure to achive this.

Answer

We assume we have a DB with table articles, and a column named posts, which will save the article written in your blog. Best part, we know that all major DB’s support UTF8. And we shall explore that feature.

Now we write a article in hindi, हेल्लो वर्ल्ड

If the UTF8 is not specified, you should see something like ?????? in ur DB else u shud see the hindi data.

Code:

First check for UTF8 compatibility with this query. If it supports you should see the output as

“Character_set_system”| “UTF8″

SHOW VARIABLES LIKE

‘character_set_system’;

Now that being checked, alter the table and just modify the column, Posts in our above example and specify it as UTF8

ALTER TABLE articles MODIFY Posts VARCHAR(20) CHARACTER SET UTF8;

Now, try to insert the hindi value and save it. Query it and u shud see the hindi text