Nicolas
Nicolas

Reputation: 137

Character encoding issue with accent

I have a weird issue with a php page. Here is the php

<?
    $fp = fopen('encoding.txt', 'a+');
    fwrite($fp, "côté");
    fclose($fp);
?>

When i try to view the txt file using a browser http://local.host/encoding.txt the result is :

côté

When i edit the source the result is :

côté

But when i download the file trough filezilla and edit it with textedit the result is :

côté

What did i missed ?

I already tried (did not change anything):

$fp = fopen('encoding.txt', 'a+');
fwrite($fp, utf8_encode("côté"));
fclose($fp);

Thanks for your help

Upvotes: 0

Views: 682

Answers (1)

Manuel
Manuel

Reputation: 382

Make sure the file is saved as UTF-8 and the Browser use UTF-8 Encoding. Maybe that's enough.

Upvotes: 1

Related Questions