Welcome Guest, Not a member yet? Register   Sign In
Correct encoding
#1

[eluser]Dauntless[/eluser]
Hi,

Actually don't think that this is CI-related, but I'm asking anyway:

In a previous site I wrote with CI, there were a lot of (fe) french characters (like é, à, ç, etc) and each time those characters could come up, I printed them like this:

Code:
htmlentities($item->name, ENT_QUOTES, 'UTF-8')

Now, this is a really annoying way; It's a lot of extra typing and easy to forget somewhere.

Is there a better way to do this, once and for all ?

I know that it also has to do with the way the data is stored in the DB, but when I just try
Code:
print 'àçé'
, the same icons (question-mark-icons) appear.

All help is appreciated!

Kind regards,
Dauntless
#2

[eluser]Dan Bowling[/eluser]
Change your page's character set. I _think_ this is the one for French:

Code:
<META http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
#3

[eluser]HdotNET[/eluser]
Keep the character set uniform from database through to file and output.

So use this:

Code:
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">

You may also want to send a UTF-8 server header prior to serving the page.

In my experience, using UTF-8 _everywhere_ means you have to pay less attention charset's in general.

EDIT: thought I was writing in a wiki and screwed the markup.
#4

[eluser]Yash[/eluser]
Try searching the forum on this topic.. There are already huge threads.
#5

[eluser]Dauntless[/eluser]
@HdotNET: I already have that line in my document...

What else could go wrong ?

I'm using ZEND studio, is there any way it could be saving my documents in the wrong encoding ?

//EDIT
I changed my workspace encoding to UTF-8 and now everything seems to be working!
For other users: In Zend: Window -> preferences -> General -> Workspace -> encoding -> UTF-8




Theme © iAndrew 2016 - Forum software by © MyBB