[Reproducible-commits] [strip-nondeterminism] 01/01: Strip javadoc locale - browsers will do detection better.

Chris Lamb lamby at moszumanska.debian.org
Sun Jul 12 20:25:38 UTC 2015


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

lamby pushed a commit to branch master
in repository strip-nondeterminism.

commit a4f0a3fb163f2762e7bc654661da126f34ddef8b
Author: Chris Lamb <lamby at debian.org>
Date:   Sun Jul 12 21:25:26 2015 +0100

    Strip javadoc locale - browsers will do detection better.
---
 lib/File/StripNondeterminism/handlers/javadoc.pm | 7 +++++++
 t/javadoc.t                                      | 6 +++---
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/lib/File/StripNondeterminism/handlers/javadoc.pm b/lib/File/StripNondeterminism/handlers/javadoc.pm
index f9536df..8b15ecf 100644
--- a/lib/File/StripNondeterminism/handlers/javadoc.pm
+++ b/lib/File/StripNondeterminism/handlers/javadoc.pm
@@ -1,5 +1,6 @@
 #
 # Copyright 2014 Andrew Ayer
+# Copyright 2015 Chris Lamb <lamby at debian.org>
 #
 # This file is part of strip-nondeterminism.
 #
@@ -57,6 +58,12 @@ sub normalize {
 			}
 			print $tempfile $line unless $line =~ /^\s*$/; # elide lines that are now whitespace-only
 			$modified = 1;
+		} elsif ($line =~ /<html lang="[^"]+">/) {
+			# Strip locale as it's inherited from environment.
+			# Browsers will do a far better job at detecting
+			# encodings, than a header ever could anyway.
+			print $tempfile "<html>\n";
+			$modified = 1;
 		} else {
 			print $tempfile $line;
 		}
diff --git a/t/javadoc.t b/t/javadoc.t
index 13967f8..c91dcf2 100644
--- a/t/javadoc.t
+++ b/t/javadoc.t
@@ -29,7 +29,7 @@ my $path2 = "$dir/b.html";
 my $original = <<'ORIGINAL';
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
 <!-- NewPage -->
-<html lang="en">
+<html lang="fr">
 <head>
 <!-- Generated by javadoc (1.8.0_20) on Mon Oct 27 21:31:13 GMT 2014 -->
 <title>Generated Documentation (Untitled)</title>
@@ -56,7 +56,7 @@ binmode $fh;
 is(do { local $/; <$fh> }, <<'EXPECTED');
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
 <!-- NewPage -->
-<html lang="en">
+<html>
 <head>
 <title>Generated Documentation (Untitled)</title>
 <script type="text/javascript">;
@@ -72,7 +72,7 @@ binmode $fh;
 is(do { local $/; <$fh> }, <<'EXPECTED');
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
 <!-- NewPage -->
-<html lang="en">
+<html>
 <head>
 <title>Generated Documentation (Untitled)</title>
 <meta name="date" content="2015-02-05">

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/strip-nondeterminism.git



More information about the Reproducible-commits mailing list