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...)
PHP returns html entity on print functions
This entity represents the BOM (Byte Order Mark, Unicode name "ZERO WIDTH NO-BREAK SPACE"). However,
- it should be at the very beginning of the file;
- it shouldn't be escaped as an HTML entity, but written as a plain character.
So something is clearly going wrong when encoding your file.
The character sequence "" is what the BOM looks like when it is encoded with UTF-8, but erroneously interpreted as Latin-1.
This might help you understand the problem.
In order to help you fix this, you need to provide more details/context on what exactly you are doing. For example, where/how do specify the encoding of the output file?
PHP Include function outputting unknown char
What you are seeing is a UTF-8 Byte Order Mark:
The UTF-8 representation of the BOM is the byte sequence EF BB BF, which appears as the ISO-8859-1 characters  in most text editors and web browsers not prepared to handle UTF-8.
Byte Order Mark on Wikipedia
PHP does not understand that these characters should be "hidden" and sends these to the browser as if they were normal characters. To get rid of them you will need to open the file using a "proper" text editor that will allow you to save the file as UTF-8 without the leading BOM.
You can read more about this problem here
PHP include() creates unwanted gaps in HTML
As Per Why is appearing in my HTML?
it may have a Simple Fix!
The character in question is the Unicode Character 'ZERO WIDTH
NO-BREAK SPACE' (U+FEFF) attached to your code on a copy/paste or during a faulty Save
its so simple to fix that,
just open that file by notepad++ and step follow -->
Encoding->Encode in UTF-8 without BOM
. then save that. It work for me as well!
Where is the data coming from?
Everything not inside your <?php ... ?>
tags is treated as text and sent to the client. So make sure not to have empty lines in your source files...
Edit: The purpose of this is to have a simple way to have a HTML file mixed with portions of PHP code without the need to echo all the HTML stuff explicitly...
json_encode creating a malformed JSON (with extra hidden character)
It could be an issue with a BOM mark. Try to save the file as normal UTF-8 instead.
Related Topics
Disable PHP in Directory (Including All Sub-Directories) With .Htaccess
Passing JavaScript Array to PHP Through Jquery $.Ajax
Is There a PHP Library For Email Address Validation
How to Get Const'S Defined on a PHP Class
"Unknown Modifier 'G' In..." When Using Preg_Match in PHP
Lamp: How to Create .Zip of Large Files For the User on the Fly, Without Disk/Cpu Thrashing
How to Properly Indent PHP/Html Mixed Code
Reading and Writing Configuration Files
How to Hide .PHP Extension in .Htaccess
How to Insert Multiple Rows from a Single Query Using Eloquent/Fluent
PHP Write File from Input to Txt
How to Return Integer and Numeric Columns from MySQL as Integers and Numerics in PHP
Is It Safe to Trust $_Server['Remote_Addr']
How to Check If an Array Contains a Specific Value in PHP