views:

1075

answers:

4

Dear StackOverflow Community,

I am running Codeigniter.

I have a few simple pages which have no DB data, are just static loaded as following from the controller. I have set everything possible to UTF-8 - I have checked headers which result to UTF8 - however it still parses wrong (these characters: ���).

function index(){

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

}

Part of my config file:

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

Part of my header view file:

<? 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"&gt;
<html >
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
....

Characters used in body (which is a body view file):

géniales - à - époustouflant

Characters get shown as (also in html source):

� se g�niales !

Where have I gone wrong?

All the best,

Ice

+3  A: 

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

Gumbo
A: 

Fixed: I had to change the physical way the files were saved on the server to UTF-8

Ice
A: 

I had the same problem with Dreamweaver CS4, but I fixed it with Notepad++ (FREE!).

1.- Use Notepad++ -> Format -> Convert to UTF-8 WITHOUT BOM.

2.- Save.

3.- REVIEW again the file and correct the characters showing wrong.

4.- Save again.

5.- You're done.

(Also make sure in the config file in CI you have UTF8).

For me at least it worked that way (Spanish).

A: 

notepad++ rules! thanks! ;)

Oscar.dR