Strange unicode characters when reading in file in node.js app

后端 未结 4 1494
青春惊慌失措
青春惊慌失措 2020-12-19 01:30

I am attempting to write a node app that reads in a set of files, splits them into lines, and puts the lines into an array. Pretty simple. It works on quite a few files exce

4条回答
  •  粉色の甜心
    2020-12-19 02:09

    Is this perhaps the BOM (Byte-Order-Mark)? Make sure you save your files without the BOM or include code to strip the BOM.

    The BOM is usually invisible in text editors.

    I know Notepad++ has a feature where you can easily strip a BOM from a file. Encoding > Encode in UTF-8 without BOM.

提交回复
热议问题