Created
September 19, 2014 16:43
-
-
Save lucas-tulio/9a27545057c60ee84f98 to your computer and use it in GitHub Desktop.
Converts the encoding of .java files from Mac Roman to UTF-8
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo "#############################################################################################" | |
echo "This script will recursively convert the encoding of all *.java files from Mac Roman to UTF8!" | |
echo "All java files in this dir and subdirs will be changed." | |
echo "Only files with special characters will be changed. Probably." | |
echo | |
echo "Data may be lost. Use it at your own risk!" | |
echo "#############################################################################################" | |
read -p "Sure? " -n 1 -r | |
echo # (optional) move to a new line | |
if [[ $REPLY =~ ^[YySs]$ ]] | |
then | |
echo "D-D-D-D-DROP THE BASS" | |
for file in $(find . -name "*.java"); do | |
mv "$file" "$file MR" | |
iconv -f MACROMAN -t UTF8 "$file MR" > "$file"; | |
rm "$file MR" | |
done | |
echo "Done!" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment