问题
I realized that all response that returns my Zend Framework 2 application contains weird characters at the beginning. For example, when I copy the source code of any page returned by ZF2, I see these characters at the beginning of the file when I paste it in Notepad++ : 
. These seem to be 6 Byte Order Mark characters following each other.
I checked the encoding of my files, and every file I opened in Notepad++ were said to be in UTF-8 w/o BOM
.
Also, I checked other pages on my server from other sites, and there is no problem.
Could you please help me understand why there is such a thing at the beginning of each page of my site, even in the Json data returned by my web services. What would be the quickest way to spot from where these are printed and how to get rid of them?
Thank you for your help.
回答1:
I eventually found my answer here: Elegant way to search for UTF-8 files with BOM?
I tried both ways described on the thread:
grep -rl $'\xEF\xBB\xBF' .
or using Total Commander available here.
It helped me find the files where the BOM character appears and was then able to convert these files to UTF-8 w/o BOM.
来源:https://stackoverflow.com/questions/32005500/find-source-of-bom-in-zend-framework-2