Created
August 22, 2016 12:36
-
-
Save pronebird/4853cd2d2eb5d78ac369ed100de72e3c to your computer and use it in GitHub Desktop.
Convert your .strings files to UTF-8 once and forever
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
*.strings text diff |
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
find . -name \*.strings -type f | \ | |
(while read file; do | |
echo "convert $file"; | |
CHARSET=$(file -b --mime-encoding "$file") | |
RC=$? | |
if [[ $RC == 0 ]]; then | |
mv "$file" "$file.original" | |
iconv -sc -f $CHARSET -t utf-8 "$file.original" > "$file" | |
rm "$file.original" | |
else | |
echo "failed to convert $file: $CHARSET" | |
fi | |
done) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment