Extra undefined character at the beginning of the answer

This prevents me from using JSON and prevents the use of React or Ember. When sending a request to the server using AJAX, I get an extra undefined unicode character, which causes a parser error, since it interrupts JSON.

I checked every php file that I have for an extra throw or echo or print, or any other function that will print something but nothing. This is not limited to JSON, but expecting text will not be a problem. But with JSON it will be parsed and it will break.

Is there anything that could interfere here?

See this for more details. The red dot represents the undefined character.

enter image description here

PS. Also, am I not closing any PHP file with a tag? > And I put the start tag at the beginning of each file.

SFC. I am using Sublime Text 3, and I do not think it has anything to do with the specification. Also, the red dot in chrome and firefox is a non-printing special Unicode character that is sent from the server, and on the server side there is only PHP.

+3
source share
1 answer

As indicated in the link posted in the comments above.

"Windows Notepad adds specification information to UTF-8 files (that is, FFFE or FEFF at the beginning of the file), which explains this behavior. In Notepad ++, for example, you can prevent UTF-8 from including specification information using the" Format "menu"


, php

!:

find . -type f -exec sed '1s/^\xEF\xBB\xBF//' -i.bak {} \; -exec rm {}.bak \;

+4

Source: https://habr.com/ru/post/1629115/


All Articles