Skip to content

Instantly share code, notes, and snippets.

@Scuilion
Created August 8, 2015 00:27
Show Gist options
  • Save Scuilion/9b061d096976d34bdfcd to your computer and use it in GitHub Desktop.
Save Scuilion/9b061d096976d34bdfcd to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
files=$(git diff --name-only HEAD | tr '\n' ' ' )
e=0
for f in $files
do
if ! git show :"$f" | iconv -f UTF-8 -t UTF-8 "$f" >/dev/null 2>&1
then
e=1
echo "The following file is not UTF-8: $f"
fi
done
exit $e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment