Skip to content

Instantly share code, notes, and snippets.

@FernandoBasso
Last active October 27, 2016 09:51
Show Gist options
  • Save FernandoBasso/d71d334797fc9ca7fe95a432a74d6cd8 to your computer and use it in GitHub Desktop.
Save FernandoBasso/d71d334797fc9ca7fe95a432a74d6cd8 to your computer and use it in GitHub Desktop.
On the command line, uses `find` and `iconv` to convert certain files from ISO-8859-1 to UTF-8 (make sure the original files are indeed in ISO-8859-1).
#!/usr/bin/bash
find ./ -name '*.php' -o -name '*.html' -o -name '*.css' -o -name '*.js' -type f |
while read file
do
echo " $file"
mv $file $file.icv
iconv -f ISO-8859-1 -t UTF-8 $file.icv > $file
rm -f $file.icv
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment