1
2
3
4
5
6
7
8
#!/bin/bash
 
for file in `find . -name '*.php' -or -name '*.tpl' -or -name '*.css' -or -name '*.js'| xargs file --mime | grep 'iso-8859-1' | awk '{gsub(/:/,"",$1); print $1}'`; do
  echo "Converting ${file}.."
  mv $file $file.iconv
  iconv -f ISO-8859-1 -t UTF-8 $file.iconv > $file
  rm -f $file.iconv
done