Skip to content

Instantly share code, notes, and snippets.

@eduardoschmidtsantos
Created February 10, 2016 15:26
Show Gist options
  • Save eduardoschmidtsantos/64285a52e4c1327aa2f8 to your computer and use it in GitHub Desktop.
Save eduardoschmidtsantos/64285a52e4c1327aa2f8 to your computer and use it in GitHub Desktop.
for f in `find . -name *.java`; do
encoding=$(file -i "$f" | sed "s/.*charset=\(.*\)$/\1/")
if [ ! "$encoding" = "utf-8" ]; then
echo recoding $f.. from $encoding to 'utf-8'
recode $encoding..utf-8 "$f"
sed -i -- 's/ISO-8859-1/UTF-8/g' $f
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment