October 31, 2013 5:58 am

How to manage international languages in MySQL database

If you are making a web site where multiple languages used like Arabic, French, Hindi or Urdu then your MySQL database default settings is not valid to do that to insert all languages in database. If you insert data in your database and database is not configured as I am going to show you in this tutorial then your data will be look like ????? and you lost your data.


So now i am going to tell you how to configure database to accept international languages.

Very important HTML settings you have to add a meta for character set UTF-8

Now create table in your database its default character set will be latin1_swedish_ci

PHPGang Character Set

You have to change it to utf8_general_ci

PHPGang Character Set 2

Here is the insert query

N’$id’ N is stands for national regional language character set.

see alos: How to use MySQLi_connect in PHP

Fetch code and query

Now your database is configured to insert all international languages.

Author Huzoor Bux

I am Huzoor Bux from Karachi (Pakistan). I have been working as a PHP Developer from last 5+ years, and its my passion to learn new things and implement them as a practice. Basically I am a PHP developer but now days exploring more in HTML5, CSS and jQuery libraries.

Tutorial Categories:
  • Daniel M.


    Bux Panhwar of PHPGang, I am so grateful to you. A Facebook like and saying thanks is the least I can do for the pain you reduced!


  • sociobuddy

    not working

  • dilawar hussain

    phpgang your are awesom….thanks a lot….

  • Gaurav Singh

    Any specific reason for using utf8_general_ci ?
    utf8_bin also does the same thing

  • Bik Byro

    I wouldn’t use mysql_query any more

  • balouchrasheed

    Dear Hazoor bux i am also workong language converter in php. i have done all steps defined by you. but unfortunately getting result like this . ?????????????
    please help

    • Your data already showing “????” or new data you insert shows you “????”.

      Old data converted to questions try these steps

      1. the db collation has to be utf8_general_ci
      2. the collation of the table with hebrew has to be utf8_general_ci
      3. in your php connection script put header('Content-Type: text/html; charset=utf-8');
      4. in xhtml head tag put
      5. after selecting the db in the connection script put mysqli_query($connection,"SET NAMES 'utf8'");