0

I am having trouble with a script that's echoing some simple text.

It should output:

M9785000 
PRE4371

But it actually outputs

M9785000 
PRE4371

The response headers are:

Accept-Ranges   bytes
Connection  close
Content-Type    text/html
Date    Tue, 28 May 2013 08:15:48 GMT
Server  Apache
X-Powered-By    PHP/5.2.17

It was chunked before but I downgraded the output so its not chunked but this doesn't help for a clean output of the echoed chars.

What could be the issue and how could I resolve it?

4

2 回答 2

3

您的问题是 Byto Order Mark (BOM)

在这里阅读更多信息:http: //www.w3.org/International/questions/qa-byte-order-mark.en.php

这可能与以下内容重复:如何从文件开头删除 ?

于 2013-06-01T18:14:08.723 回答
1

您的文件中有一个字节顺序标记 (BOM) 字符。它用于UTF-8编码,这会导致在转换为ISO-8859-1编码时出现。

如果您有记事本++,则可以使用内置选项。转到菜单 > 编码 > 在没有 BOM 的情况下转换为 UTF-8。这是一个很棒的编辑器,我用这个。

如果你更喜欢 vim,你可以这样做:

vim file
:set nobomb
:wq
于 2013-06-02T05:10:35.683 回答