Skip to content

Instantly share code, notes, and snippets.

@wfaler
Created November 28, 2013 17:52
Show Gist options
  • Save wfaler/7695870 to your computer and use it in GitHub Desktop.
Save wfaler/7695870 to your computer and use it in GitHub Desktop.
Note on how to change files to UTF-8 encoding regardless of original encoding
TMPFILE="utf8.tmp"
cp $1 $TMPFILE
enc=`file -i $1 | awk 'BEGIN {FS = "="} ; {print $2; }'` # gets encoding of a file
iconv -f $enc -t utf-8 $TMPFILE > $1 # changes encoding to UTF-8
rm $TMPFILE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment