March 6, 2012

UTF-8 text not fetching accurately in CodeIgniter php

Question by SarwarCSE

UTF-8 problem in CodeIgniter from mysql Problem

when i fetch utf data from mySql database using codeigniter active record then my text show like this

বাংলা নাম চেক করার জনà§à¦¯

actual text is

বাংলা নাম চেক করার জন্য

i have checked the config file

$db['default']['char_set'] = 'utf8';
$db['default']['dbcollat'] = 'utf8_general_ci';

Without using Codeigniter i can show the text accurately in web site.

Answer by Starx

Make sure you have specified correct character set, in your html.

<meta http-equiv='Content-Type' content='Type=text/html; charset=utf-8'>

Make sure you have include the above meta tag in the top of your html.

In case of HTML5: use <meta charset='utf-8'>

Author: Nabin Nepal (Starx)

Hello, I am Nabin Nepal and you can call me Starx. This is my blog where write about my life and my involvements. I am a Software Developer, A Cyclist and a Realist. I hope you will find my blog interesting. Follow me on Google+

...

Please fill the form - I will response as fast as I can!