How can I remove the BOM from a UTF-8 file?

后端 未结 5 1651
忘掉有多难
忘掉有多难 2020-12-06 04:53

I have a file in UTF-8 encoding with BOM and want to remove the BOM. Are there any linux command-line tools to remove the BOM from the file?

$ file test.xml
         


        
5条回答
  •  自闭症患者
    2020-12-06 05:11

    IF you are certain that a given file starts with a BOM, then it is possible to remove the BOM from a file with the tail command:

    tail --bytes=+4 withBOM.txt > withoutBOM.txt
    

提交回复
热议问题