You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
472 B
17 lines
472 B
#! /bin/sh |
|
# |
|
# Very simple script to detect and convert files that we want to re-encode to UTF8 |
|
|
|
git ls-tree -r --name-only HEAD | \ |
|
while read F; do |
|
charset=`file -bi "$F" | sed -e 's|.*charset=||'` |
|
if [ "$charset" != "utf-8" -a "$charset" != "binary" -a "$charset" != "us-ascii" ]; then |
|
iconv -f ISO-8859-1 -t UTF8 < "$F" > "$F.utf8" && \ |
|
( cmp -s "$F" "$F.utf8" || \ |
|
( echo "$F" |
|
mv "$F" "$F.iso-8859-1" |
|
mv "$F.utf8" "$F" |
|
) |
|
) |
|
fi |
|
done
|
|
|