checkAPIs: Check for non-UTF-8 instead of non-ASCII.

Replace our check for non-ASCII characters with one that checks for a
proper UTF-8 encoding.

Change-Id: I8386f5d4376b05bc10358c0d2849a214d8ff00a0
Reviewed-on: https://code.wireshark.org/review/32866
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Gerald Combs <gerald@wireshark.org>
This commit is contained in:
Gerald Combs 2019-04-15 12:20:25 -07:00
parent 0974b68f5c
commit bd75f5af0a
1 changed files with 5 additions and 2 deletions

View File

@ -20,6 +20,8 @@
#
use strict;
use Encode;
use English;
use Getopt::Long;
use Text::Balanced qw(extract_bracketed);
@ -1132,8 +1134,9 @@ while ($_ = pop @filelist)
$line = 1;
while (<FC>) {
$fileContents .= $_;
if ($_ =~ m{ [\x80-\xFF] }xo) {
print STDERR "Error: Found non-ASCII characters on line " .$line. " of " .$filename."\n";
eval { decode( 'UTF-8', $_, Encode::FB_CROAK ) };
if ($EVAL_ERROR) {
print STDERR "Error: Found an invalid UTF-8 sequence on line " .$line. " of " .$filename."\n";
$errorCount++;
}
$line++;