[devscripts] 01/01: licensecheck: skip unknown charset when decoding

dod at debian.org dod at debian.org
Thu Nov 12 20:08:48 UTC 2015


This is an automated email from the git hooks/post-receive script.

dod pushed a commit to branch master
in repository devscripts.

commit 4d4d0946f2088e50adeac55b20466451df8aae78
Author: Dominique Dumont <dod at debian.org>
Date:   Thu Nov 12 21:07:41 2015 +0100

    licensecheck: skip unknown charset when decoding
---
 scripts/licensecheck.pl | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/scripts/licensecheck.pl b/scripts/licensecheck.pl
index 5099f8d..4b93cee 100755
--- a/scripts/licensecheck.pl
+++ b/scripts/licensecheck.pl
@@ -344,9 +344,11 @@ while (@files) {
           wait_child => 1);
     my $charset ;
     chomp $mime;
+    my $decode_text = 0;
     if ($mime =~ m/; charset=((?!binary)(?!unknown)[\w-]+)/) {
 	# regular text file, may be postscript
 	$charset = $1;
+	$decode_text = 1;
     }
     elsif ($mime =~ m!application/postscript;\s+charset=([\w-]+)!) {
 	# postscript files with embedded binary are detected as binary
@@ -367,7 +369,7 @@ while (@files) {
     while ( <$F>) {
 	last if ($. > $OPT{'lines'});
 	my $data = $_;
-	$data = decode($charset, $data) if $charset !~ /binary$/;
+	$data = decode($charset, $data) if $decode_text;
 	$content .= $data;
     }
     close($F);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/collab-maint/devscripts.git



More information about the devscripts-devel mailing list