Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Codeigniter Character Encoding Issues

I have a few simple pages which have no database data, and are just statically loaded from the controller. I have set everything possible to UTF-8 encoding. I have checked headers, which result to UTF-8. However, it still parses wrong showing these characters: ���.

Controller:

function index(){

    $this->load->view('french/header_view');
    $this->load->view('french/homepage_view');
    $this->load->view('french/footer_view');

}    

Config File:

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

Header View:

<? header("Content-Type: text/html; charset=UTF-8"); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html >
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
....

Characters Used in Body View:

géniales - à - époustouflant

Characters generated:

� se g�niales !

Where have I gone wrong? Thanks for your help!

like image 656
Ice Avatar asked Mar 02 '09 11:03

Ice


2 Answers

It seems that the data is not encoded in UTF-8. Have you checked the encoding settings of your editor?

like image 75
Gumbo Avatar answered Oct 24 '22 04:10

Gumbo


Old but still relevant:

http://philsturgeon.co.uk/blog/2009/08/UTF-8-support-for-CodeIgniter

like image 29
Phil Sturgeon Avatar answered Oct 24 '22 03:10

Phil Sturgeon