Search code examples
phpmysqlcodeigniter-2

Get the garbage values from mysql database correctly in hindi


I have a database that is having values stored in the form "खेल"( for खेल). It is getting displayed correctly on previous website by just fetching the data from the database.However when i dumped that database and try to fetch using queries in codeignitor, it displays the raw value i.e खेल instead of खेल. I have set charset to utf-8 in header as well as in database.php file in codeigniter. Still the same issue.


Solution

  • Previously data was stored in latin-1 format and whwn i dumped that in my database which was in unicode format the values come in the form of "खेल"( for खेल), so i fired following query in the database

    convert(cast(convert(category using latin1) as binary) using utf8)

    for converting data in category column back to appropriate format i.e खेल.