fixed :) The language was Herbew which we wanted to be shown on page.
I changed database.php setting to
$db['default']['char_set'] = 'latin1';
$db['default']['dbcollat'] = 'latin1_swedish_ci';
And it works :)
UTF-8 issues in CodeIgniter when fetching data from mysql using codeigniter active record set
-
10-07-2023 - |
Question
I have applied all tips/tricks available online to enable my codeigniter and mysql with utf8.
I have database and its tables with collation "utf8_unicode_ci"
.
In html, I have applied meta tag for utf8 : <meta charset="utf-8">
In my codeigniter instance, I have reconfirmed setting in:
config.php
`$config['charset'] = 'UTF-8'
And in database.php
file, I have:
$db['default']['char_set'] = 'utf8';
and
$db['default']['dbcollat'] = 'utf8_general_ci';
When I am showing records using codeigniter active record, it doesn't show utf8 decoded characters whereas when I am running native php-mysql call in same view file I can see correct characters displayed there. So this confirms that my database and html meta tag is all ok, I can sense the issue on codeigniter part where it is not calling mysql with utf8.
Does any one know how to fix this ?
Thanks.. Anjum
UPDATE: For future reference
The language was Herbew which we wanted to show on page. I changed database.php
setting to:
$db['default']['char_set'] = 'latin1';
$db['default']['dbcollat'] = 'latin1_swedish_ci';
Solution