Skip to content

Instantly share code, notes, and snippets.

@pronebird
Created August 22, 2016 12:36
Show Gist options
  • Save pronebird/4853cd2d2eb5d78ac369ed100de72e3c to your computer and use it in GitHub Desktop.
Save pronebird/4853cd2d2eb5d78ac369ed100de72e3c to your computer and use it in GitHub Desktop.
Convert your .strings files to UTF-8 once and forever
*.strings text diff
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