前一段时间写PHP,经常在解析文件之前就要对数据进行处理判断,并以header()的方式进行页面跳转.然而后来将文件放到 linux 服务器时常碰到header()解析出错的情况,而在 windows 开发环境中本地调试无任何问题.后来发现是文件编码格式的原因,转换成以UTF-8无BOM编码格式的文件就不会报错了. 附上BOM的解释:https://en.wikipedia.org/wiki/Byte_order_mark 以及知乎上的讨论:「带 BOM 的 UTF-8」和「无 BOM 的 UT
VS的编译器对Unicode源代码支持如下: UTF-16 little endian with or without byte order mark (BOM). UTF-16 big endian with or without BOM. UTF-8 with BOM . vs2010 编译utf-8格式的代码总报错 带签名也就是带 BOM 信息,不带签名就是不带 BOM. BOM,即 Byte Order Mark,也即字节流标记,它是用来让应用程序识别所用的编码的.UTF-8 的 BOM
https://stackoverflow.com/questions/2223882/whats-the-difference-between-utf-8-and-utf-8-without-bom Answer1 The UTF-8 BOM is a sequence of Bytes at the start of a text-stream (EF BB BF) that allows the reader to more reliably guess a file as being e