How to avoid echoing character 65279 in php?

To conclude, and specify the solution:

Windows Notepad adds the BOM character (the 3 bytes: EF BB BF) to files saved with utf-8 encoding.

PHP doesn’t seem to be bothered by it – unless you include one php file into another –
then things get messy and strings gets displayed with character(65279) prepended to them.

You can edit the file with another text editor such as Notepad++ and use the encoding
“Encode in UTF-8 without BOM”,
and this seems to fix the problem.

Also, you can save the other php file with ANSI encoding in notepad – and this also seem to work (that is, in case you actually don’t use any extended characters in the file, I guess…)

Leave a Comment