Monday, March 16, 2009

UTF8 Setting in UTF-8 in MySQL, Hibernate and WebApps

Usually web application development is strainght forward for english language but some time we have to develop application which multi-lingual(character support required which are other then english).Multi-lingual is not a trivial as english.Internationlization options using application resources or resource bundle is avaible for labeling in diffrent langauges but some time we have manupulate,store data this data which required some settings.

For multi-language we have to change application,database encoding into UTF-8.

UTF-8

UTF-8 (8-bit UCS/Unicode Transformation Format) is a variable-length character encoding for Unicode. It is able to represent any character in the Unicode standard, yet the initial encoding of byte codes and character assignments for UTF-8 is backwards compatible with ASCII. For these reasons, it is steadily becoming the preferred encoding for e-mail, web pages and other places where characters are stored or streamed.

I have found very good blog related to this topic which is http://www.warski.org/blog/?p=4

I have to add some new setting related to mysql database

Add these line in my.cnf







[mysqld]

default-character-set=utf8

default-collation=utf8_unicode_ci

character-set-server=utf8

collation-server=utf8_unicode_ci

init_connect='SET NAMES utf8'



[client]

default-character-set=utf8

No comments: