Skip to content

Instantly share code, notes, and snippets.

@x2q
Created March 25, 2013 16:22
Show Gist options
  • Select an option

  • Save x2q/5238377 to your computer and use it in GitHub Desktop.

Select an option

Save x2q/5238377 to your computer and use it in GitHub Desktop.
#!/bin/sh
# Recodes specified file to UTF-8, except if it seems to be UTF-8 already
result=`grep -c [åäöÅÄÖ] $1`
if [ "$result" -eq "0" ]
then
echo "Recoding $1 from ISO-8859-1 to UTF-8"
recode ISO-8859-1..UTF-8 $1 # overwrites file
else
echo "$1 was already UTF-8 (probably); skipping it"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment