Showing posts with label display in tamil. Show all posts
Showing posts with label display in tamil. Show all posts

Wednesday, June 6, 2012

How to store தமிழ்(Tamil) in MySql


      MySQL has Multi-Language support, Only think we have to do is create a database with charset UTF-8.

       UTF-8 (UCS Transformation Format — 8-bit) is a variable-width encoding that can represent every character in the Unicode character set.UTF-8 has become the dominant character encoding for the World-Wide Web, accounting for more than half of all Web pages. The Internet Engineering Task Force (IETF) requires all Internet protocols to identify the encoding used for character data, and the supported character encodings must include UTF-8.The Internet Mail Consortium (IMC) recommends that all e-mail programs be able to display and create mail using UTF-8. UTF-8 is also increasingly being used as the default character encoding in operating systems, programming languages, APIs, and software applications.


CREATE DATABASE WITH CHARSET UTF-8 :

CREATE TABLE thirukkural
(
 ID INTEGER NOT NULL AUTO_INCREMENT,
 ChapterName VARCHAR(50) NOT NULL DEFAULT '',
 SectionName VARCHAR(50) NOT NULL DEFAULT '',
 Verse TEXT,
 Translation TEXT,
 Explanation TEXT,
 PRIMARY KEY(id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

On client side (browser) must add following code in header section : 

<META HTTP-EQUIV="Content-Type" CONTENT="text/html"; charset="utf-8" />

Note : 
            If the result shows like the ???? then prpoerly in your system (windows XP) need to install the extral language support tool by enabling the following options,

                   Control Panel -> Regional and Language Option -> Languages -> Install files for complex script and right-to-left languages (including Thai).