Skip to content

Instantly share code, notes, and snippets.

@ppdeassis
Last active December 18, 2015 04:59
Show Gist options
  • Save ppdeassis/5729515 to your computer and use it in GitHub Desktop.
Save ppdeassis/5729515 to your computer and use it in GitHub Desktop.
File encoding conversion
# iso to utf-8
iconv -f iso-8859-1 -t utf-8 INPUT_FILE > OUTPUT_FILE
# mac to utf-8 (OS X Office Excel exports CSV with this encoding)
iconv -f mac -t utf-8 INPUT_FILE > OUTPUT_FILE
# converting .DAT files in a directory from ISO-8859-1 to UTF-8
find input/dir -iname "*.dat" -type f -exec bash -c 'iconv -f iso-8859-1 -t utf-8 "{}" > output/dir/"{}"' \;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment