Created
February 14, 2014 13:38
-
-
Save gsouf/9001102 to your computer and use it in GitHub Desktop.
Recursively convert encoding of all files in a project
This file contains 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
encodeTo="UTF-8" | |
# CHANGE THE PATTERN IF NEEDED | |
for filename in ` find . -type f -name "*.php"` | |
do | |
echo $filename | |
enc=`file -bi $filename | awk -F"charset=" '{print $2}'` | |
iconv -f $enc -t $encodeTo $filename -o $filename | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment