Find source of BOM in Zend Framework 2

跟風遠走 提交于 2019-12-12 02:22:42

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!