RSS .92| RSS 2.0| ATOM 0.3
  • Home
  • About
  •  

    Solution to retrieving devanagari / hindi / marathi from MySQL database

    Web developers working with Indian devanagari language may face some issues while pulling out strings from the MySQL database. If not done correctly, one will get a series of question marks instead of the devanagari.

    Solution:

    Set the ‘collation’ of the database, table and column to ‘utf8_unicode_ci‘. Now, whenever you want to retrieve the unicode string, simply run the below given query before running the actual query to retrieve the unicode string.

    mysql_query("SET NAMES 'utf8'");//run this query first
    $resource=mysql_query('SELECT book_title FROM hindi_marathi_books');

    Thats it! Now use PHP to parse the strings as you like!

    One Response to “Solution to retrieving devanagari / hindi / marathi from MySQL database”

    1. Din says:

      Hello

      How come you are not at all present in TD forum these days ? ?

      Has been a long time ! Howz things at your end ? Howz life n studies ?

      Din.

    Leave a Reply