Skip to content

Instantly share code, notes, and snippets.

@pmarreck
Created October 11, 2011 21:54
Show Gist options
  • Save pmarreck/1279575 to your computer and use it in GitHub Desktop.
Save pmarreck/1279575 to your computer and use it in GitHub Desktop.
Fixing the BOM (byte order marker) at the beginning of utf8 files.
#!/usr/bin/env sh
# BOM=`echo -ne '\xEF\xBB\xBF'`
# echo "$BOM$(cat $1)" > $1
(printf '\xEF\xBB\xBF'; cat $1) > $1.enc; mv -f $1.enc $1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment