diff options
author | Adam Borowski <kilobyte@angband.pl> | 2010-12-13 13:36:03 +0100 |
---|---|---|
committer | Adam Borowski <kilobyte@angband.pl> | 2010-12-13 13:36:03 +0100 |
commit | 0244304e6fdf69e3b5fc45431161e13f9bfe9adb (patch) | |
tree | 33eaf1222f35c29b6a9983a2fc7f7f7845c619b0 /crawl-ref/source/util/checkwhite | |
parent | d0f98332d2f1423320bdcb9da0d7de376d0eb27c (diff) | |
download | crawl-ref-0244304e6fdf69e3b5fc45431161e13f9bfe9adb.tar.gz crawl-ref-0244304e6fdf69e3b5fc45431161e13f9bfe9adb.zip |
Disallow encodings other than UTF-8 in the source.
Diffstat (limited to 'crawl-ref/source/util/checkwhite')
-rwxr-xr-x | crawl-ref/source/util/checkwhite | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/crawl-ref/source/util/checkwhite b/crawl-ref/source/util/checkwhite index 610c06a893..3d1520bab8 100755 --- a/crawl-ref/source/util/checkwhite +++ b/crawl-ref/source/util/checkwhite @@ -1,4 +1,5 @@ #!/usr/bin/perl -w +use Encode; open FLIST, "git ls-files|" or die "Can't run git ls-files"; @@ -24,6 +25,14 @@ while(<FLIST>) print "tab: $file\n" if s/ {0,7}\t/ /sg; print "spaces at eol: $file\n" if s/ +\n/\n/sg; print "CR: $file\n" if s/\r//sg; + eval{decode("UTF-8", "$_", Encode::FB_CROAK)}; + if ($@) + { + print "invalid UTF-8: $file\n"; + # We don't know the actual encoding, assume a Windows-using american/ + # frenchman/german/finn. Sorry, polacks and russkies. + Encode::from_to($_, "CP1252", "UTF-8"); + } if ($_ ne $cont) { |