Adding UTF-8 BOM from the command line Posted on 2020年7月16日2020年7月16日 by 迎迎 姚 Shell script to add UTF-8 BOM to any file #!/bin/bash file=$1 cat $file > $file".temp" printf "\xEF\xBB\xBF" > $file cat $file".temp" >> $file rm $file".temp"Code language: PHP (php)