Jump to content


Photo

Character Encoding and PhP


  • Please log in to reply
3 replies to this topic

#1 Atomg

Atomg
  • New Members
  • Pip
  • Newbie
  • 9 posts

Posted 03 June 2006 - 07:33 PM

I have a question conerning character encoding and php.

I have put the line AddDefaultCharset ISO-8859-1 in my .htaccess file as this makes all my page using the correct encoding. My pages are in french so I need é à ù etc. All my html files are ok.

But all my .php files are not.
Their is two examples where i write ééé ààà êê ù etc. in html and in php I echo ééé ààà êê ù etc.

[a href=\"http://beadventure.ca/test/char/index.html\" target=\"_blank\"]The correct webpage in html[/a]
[a href=\"http://beadventure.ca/test/char/index.php\" target=\"_blank\"]The NON-correct webpage in php[/a]

I think its in the configuration of php. I'll need to contact my web host but I don't know what to say. And perhaps their is way without the need to contact them.

I'm pretty sure that I can change something on my side (like a line of code or something) because I host a phpBB forum on this website (where phpBB forum is in php... lol =) ) and the é à ù are correctly rendered.

I know that I can go in my internet otions and change the encoding by myself, but it's not very nice to do... =(

I would like some help on this, thank you for your time everyone.

#2 Atomg

Atomg
  • New Members
  • Pip
  • Newbie
  • 9 posts

Posted 04 June 2006 - 08:09 PM

Is my question too difficult? Should I post it in another forum?

#3 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 04 June 2006 - 08:38 PM

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<html lang="fr">
<title>blank page</title>
</head>
<body>
ééé ààà êê ù etc.

</body>
</html>
Note the language definition
Legend has it that reading the manual never killed anyone.
My site

#4 Atomg

Atomg
  • New Members
  • Pip
  • Newbie
  • 9 posts

Posted 23 September 2006 - 02:37 PM

Andy, you'r solution was not working and I was already trying this.

Perhaps their is something missing on my server configuration.

However doing the following will ALWAYS work (for me...) (adding the header() at the top)

<?php
// Default content type (allow àéîö...)
header("Content-Type: text/html; charset=ISO-8859-1");
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<html lang="fr">
<title>blank page</title>
</head>
<body>
ééé ààà êê ù etc.

</body>
</html>





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users