Skip to content

Instantly share code, notes, and snippets.

@devxoul
Last active August 29, 2015 14:05
Show Gist options
  • Save devxoul/9e54a29ce0b855bad2ed to your computer and use it in GitHub Desktop.
Save devxoul/9e54a29ce0b855bad2ed to your computer and use it in GitHub Desktop.
Convert `Localizable.strings` file encoding to such encoding.
#!/bin/sh
ENCODING="utf-8"
for file in *.lproj/Localizable.strings; do
charset=`file -I "$file" | sed 's/.*charset=\(.*\)/\1/'`
if ! [[ "$charset" =~ "$ENCODING" ]]
then
output="$file.tmp"
iconv -f "$charset" -t "$ENCODING" "$file" > "$output" &&
rm "$file" &&
mv "$output" "$file"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment