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).

16 comments:

  1. how to enable 'extral language support' in windows 7? pls mail me:
    yousufmsc@yahoo.co.in

    ReplyDelete
    Replies
    1. If you already installed external language(http://www.google.com/inputtools/windows/index.html) then for switch between them goto
      Control panel -> region and language ->keyboards and languages -> Change keyboard.

      Delete
  2. HI Logu, I am still facing issues with ???? characters in display. Am using win7 ultimate, have installed Language Interface Packs for tamil & google input tools also. have changed keyboard option. what should I do more to get tamil fonts in display?

    ReplyDelete
  3. i am using windows 8. i'm just getting ???? help me..

    ReplyDelete
  4. send your file to my mail rockroy93@gmail.com

    ReplyDelete
  5. புணர்ச்சிவிதும்பà

    bro ithu enna format bro ennoda sql la intha mathuri na save panna my website la tamil display aguthu

    otherwise it returns ????

    enna format sonnenga ennoda tamil word ah athuku convert panni save panniruvaen

    ReplyDelete
    Replies
    1. phpmyadmin edit column name -> collation--> utf-8-genral_ci

      Delete
  6. This comment has been removed by the author.

    ReplyDelete
  7. ??????????? i get this output again and again

    ReplyDelete