1

I'm trying to print accents, through a script, not a website, but they doesn't print correctly. What I tried :

<?php 
header('Content-Type: text/html; charset=iso8859-15');
echo "éè";
?>

And it gives :

ΘΦ

I'm executing this sample of code from a Command Prompt on Windows. How can I fix it ?

Thanks in advance

Stiti_
  • 53
  • 5
  • Possible duplicate of http://stackoverflow.com/questions/28797100/accents-printed-differently-every-time-in-php-and-html?s=1|0.7992 – Falt4rm May 25 '15 at 10:22
  • strings in php are array of bytes, not arrays of characters, hence they cannot work natively with multibyte encodings, not on the commandprompt at least. your header is doing basically nothing because you are not printing on an HTML document, but just on your console, that doesn't natively supports special characters. – briosheje May 25 '15 at 11:00

3 Answers3

1

change to

header('Content-Type: text/html; charset=iso8859');

or

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

also you can use symbol code without space "&# 233;"

becouse your charset doesn't accept this symbols

Nefro
  • 195
  • 1
  • 11
  • Thanks for your answer. This is what I tried first, but it gives me the same the result. Any idea of why ? – Stiti_ May 25 '15 at 10:27
0

This is working as you expected.

try like this.

Just change charset=UTF-8 in header

<?php 
header("Content-Type: text/html; charset=UTF-8");
echo "éè";
?>

Demo

RaMeSh
  • 3,330
  • 2
  • 19
  • 31
0

You can try this.Use following php inbuilt function to avoid those characters on given string.

html_entity_decode($given_string,ENT_QUOTES, "ISO-8859-1");
Sagar
  • 642
  • 3
  • 14