Jump to content

Character Encoding


doddsey_65

Recommended Posts

I have specified the use of utf-8 encoding using:

 

header('Content-type: text/html; charset=utf-8');

 

but when ever I try to print a foreign charcter like é i get a question mark in a diamond. Am i missing something? I have also set the language to french using

 

<html lang="fr" xml:lang="fr" xmlns="http://www.w3.org/1999/xhtml">

 

Link to comment
https://forums.phpfreaks.com/topic/244373-character-encoding/
Share on other sites

Edit: Are you turning them into HTML Entities?  If you are storing them in a Database the default Character Set is latin1 or what I believe is ISO-8859-1, if you turn them into entities before you store them it may actually display correctly.

 

This kind of fit my original post, but I think I was completely incorrect.

 

So question is are you storing the funky e as the funky e in a database or are you converting it to an entity?

Link to comment
https://forums.phpfreaks.com/topic/244373-character-encoding/#findComment-1255153
Share on other sites

Just give a simple try it may help "use HTML5 standards"

 

<!doctype html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>

 

if i were going towards html5 then i would need to use

 

<meta charset=UTF-8">

 

Link to comment
https://forums.phpfreaks.com/topic/244373-character-encoding/#findComment-1255155
Share on other sites

UTF-8 is the best solution for encoding, however going full utf-8 is much more than just <meta>, you can find a lot about this on google, but few key points you might want to look into:

 

-> html utf-8 (meta)

-> php utf-8 (look at your script file encoding)

-> db utf-8 (look at your db encoding)

 

GL

Link to comment
https://forums.phpfreaks.com/topic/244373-character-encoding/#findComment-1255276
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.