PCD25
PCD25

Reputation: 23

Character encoding problem UTF8

here is my index.php

<?php session_start(); ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
  <head>
  <meta http-equiv="content-type" content="text/html; charset=utf8">

  </head>
  <body>

    <center>
        some special character: éá
    </center>
  </body>
</html>

and this is how it looks like in the browser:some special character: ĂŠĂĄ

if in Notepad++ i set it to Convert to UTF-8 then the text looks like it should but then i have the "Cannot send session cookie - headers already sent by" warning note becouse the BOM characters. if i set the charcter coding to "without BOM" in Notepad++ then the characters are messed up again.

Upvotes: 0

Views: 3279

Answers (1)

convert the file to UTF-8 without BOM and then add this line to our php files at the first line.

<?php header('content-type: text/html; charset: utf-8'); ?>

this will help you i hope.

Upvotes: 3

Related Questions