Php – Displaying UTF8 Character on Codeigniter

codeignitercodeigniter-2php

Config.php

$config['charset'] = 'UTF8';

database.php

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

html header

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

my database has the collation of utf8_general_ci and my all files are encoded on utf8 even though i could not display my unicode character on my page

this always displays
वि.सं. २०१४ सालमा

Best Solution

you need to make sure you have utf8 everywhere, like in config.php

$config['charset'] = "UTF-8"; //not UTF8

in php.ini

default_charset = "utf-8"

for database

DEFAULT CHARSET=utf8;
Related Question