PHP headers and file encoding

Messages
89
Reaction score
0
Points
6
My PHP files are encoded in UTF-8 format (as I want to use one particular symbol which is not supported by ANSI).

But UTF-8 seems to be affecting the header statement.

Even the simplest of PHP codes is not working -

Code:
<?php
header("location: destination.php");
?>

It is throwing an error "Cannot modify header information – headers already sent".

However when I change the encoding back to ANSI, the problem disappears.

So why is it not working with UTF-8?
 
Last edited:

essellar

Community Advocate
Community Support
Messages
3,295
Reaction score
227
Points
63
I already answered this in your previous thread: it's a BOM (byte order marker) character (the first character on the page, before the text you enter). You need to save your UTF-8 files without a BOM (that's usually an option in your editor, wherever you set the encoding). It's the same thing that's playing with your layout in webkit and Opera.
 
Top