What's  sign at the beginning of my source file?

后端 未结 4 1103
隐瞒了意图╮
隐瞒了意图╮ 2021-01-04 08:36

I have a PHP source file where  characters automatically got added in! I don\'t know from where they have come. I\'m not getting any parse errors but it results in weird

相关标签:
4条回答
  • 2021-01-04 09:31

    From a tool like vi or vim, you can modify and save the file without a BOM with the two following commands :

    :setlocal nobomb
    

    and then

    :w
    
    0 讨论(0)
  • 2021-01-04 09:34

    You propably save the files as UTF-8 with BOM. You should save them as UTF-8 without BOM.

    0 讨论(0)
  • 2021-01-04 09:36

    It's called Byte Order Mark, and doesn't always have to be "". http://en.wikipedia.org/wiki/Byte_order_mark

    Some Windows applications add BOM by default. In Notepad++ you can use some options in the Encoding menu like Encode in UTF without BOM or Convert to UTF without BOM.

    0 讨论(0)
  • 2021-01-04 09:38

    I believe that whether you save it UTF-8 with or without BOM it still happens. I don't think it makes a difference.

    Try it, see if it helps.

    0 讨论(0)
提交回复
热议问题