when I run a command like:

cat file1.js file2.js file3.js > all.js

On mac osx the all.js has strange characters prepended at the boundaries of the files.

The strange characters are the following values in hex editor:

EF BB BF

Anyone know what OS setting I need to change?

有帮助吗?

解决方案

EF BB BF is the UTF-8 representation of U+FEFF - the UTF BOM (Byte Order Mark). It is placed at the beginning of the file by some editors and its purpose is to identify whether the originator system was little endian or big endian. This is redundant as UTF-8 uses fixed byte ordering and therefore the BOM only signals the beginning of UTF-8-endcoded text. Check your editor's settings and tell it not to write BOMs.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top