0

I have an issue with UTF-8 symbols, such as ☃ - this is being displayed as ˜Ƒ on the site.

The database, table and column charset is UTF8 and utf8_unicode_ci collation.

I have a header

Content-Type => text/html; charset=utf-8

and a meta tag

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

php.ini has a default encoding of utf-8

I have the following lines in my my.cnf file

[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
default-character-set=utf8
default-collation=utf8_general_ci
character-set-server=utf8
collation-server=utf8_general_ci
init-connect='SET NAMES utf8'

[client]
default-character-set=utf8

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

All files are with a UTF-8 encoding. When I output the same data in the Mysql Cli everything's OK, but when its displayed on the page, symbols are messed up.

I'm out of options here, please help :(

jimbo
  • 99
  • 1
  • 11
  • I don't know CI specifically, but likely you need to set `encoding` to `utf8` somewhere in your CI database connection configuration file. – deceze Jul 07 '14 at 10:17

1 Answers1

0

Write this line on root/index.php, and see if it works:

header('Content-Type: text/html; charset=UTF-8');

This will set the header to utf. it should be the first line before any white-spaces or anything.

Nil'z
  • 7,487
  • 1
  • 18
  • 28