Revision e71aab1c02e6a47ec56b1e341e80d09797d3d4de authored by Rich Salz on 18 November 2015, 21:58:40 UTC, committed by Rich Salz on 18 November 2015, 21:58:40 UTC
Reviewed-by: Steve Marquess <marquess@openssl.com>
1 parent b77390a
Raw File
toutf8.sh
#! /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
back to top