forked from osmocom/wireshark
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>sylvain/gmr1
parent
0974b68f5c
commit
bd75f5af0a
|
@ -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++;
|
||||
|
|
Loading…
Reference in New Issue