QuentinCaffeino
QuentinCaffeino

Reputation: 308

PHP returns  html entity on print functions

Always when I use print/print_r/echo/var_dump and etc. my php file adds  at the end of the text. For example: echo 'a';, will return a. Trying to reinstall php didn't help. Encoding of the file is UTF-8 with BOM. Without BOM, it returns  at the end.

Upvotes: 0

Views: 5496

Answers (1)

lenz
lenz

Reputation: 5817

This entity represents the BOM (Byte Order Mark, Unicode name "ZERO WIDTH NO-BREAK SPACE"). However,

  1. it should be at the very beginning of the file;
  2. 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?

Upvotes: 3

Related Questions