Reputation: 39
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.
Upvotes: 2
Views: 766
Reputation: 39
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 खेल.
Upvotes: 1
Reputation: 368
I tried this I'm also not getting the output.I tried setting db collation to utf8_unicode_ci also.But it is not working.
What I usually does is store the data as varchar with collation utf8mb4_unicode_ci so we could store the data in Hindi itself (ie खेल instead of खेल) .This helps me in reading and debuging easily in sql itself
Upvotes: 0