Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@greenrobot
Created February 18, 2014 13:35
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save greenrobot/9071091 to your computer and use it in GitHub Desktop.
Save greenrobot/9071091 to your computer and use it in GitHub Desktop.
Bash script to convert Java sources to UTF-8 recursively
#!/bin/sh
# For Windows: http://gnuwin32.sourceforge.net/packages/libiconv.htm
PATH=$PATH:/c/Program\ Files\ \(x86\)/GnuWin32/bin/
for file in $(find -name "*.java")
do
echo $file
iconv -f ISO-8859-1 -t UTF-8 "$file" >"${file%}.tmp"
mv "$file.tmp" "$file"
# dos2unix doesn't seem to work here!? IntelliJ did better here.
dos2unix "$file"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment