W3C home > Mailing lists > Public > www-validator-cvs@w3.org > December 2011

markup-validator commit: Override inline charset indication of HTML5 direct input.

From: Mercurial notifier <nobody@w3.org>
Date: Mon, 12 Dec 2011 19:50:30 +0000
Message-Id: <E1RaBtO-00005j-Mi@mcbain.w3.org>
To: markup-validator updates <www-validator-cvs@w3.org>
changeset:   3274:096bd336331d
tag:         tip
user:        Ville Skyttä <ville.skytta@iki.fi>
date:        Mon Dec 12 21:50:25 2011 +0200
files:       httpd/cgi-bin/check
description:
Override inline charset indication of HTML5 direct input.

The inline charset indication is supposed to be ignored in direct
input mode, but validator.nu does not work that way but throws an
error if it finds an inconsistency (which may originate from us
always POSTing the file to it as UTF-8).


diff -r aaa4f829403b -r 096bd336331d httpd/cgi-bin/check
--- a/httpd/cgi-bin/check	Mon Dec 12 21:36:36 2011 +0200
+++ b/httpd/cgi-bin/check	Mon Dec 12 21:50:25 2011 +0200
@@ -1048,10 +1048,13 @@
     my $req = HTTP::Request->new(POST => $url);
     my $ct = &is_xml($File) ? "application/xhtml+xml" : "text/html";
 
-    if ($File->{Opt}->{DOCTYPE} || $File->{Charset}->{Override}) {
+    if ($File->{Opt}->{DOCTYPE} || $File->{Charset}->{Override} ||
+        $File->{'Direct Input'})
+    {
 
         # Doctype or charset overridden, need to use $File->{Content} in UTF-8
-        # because $File->{Bytes} is not affected by the overrides.
+        # because $File->{Bytes} is not affected by the  overrides.  Note that
+        # direct input is always considered an override here.
 
         &override_charset($File, "UTF-8");
 
@@ -1068,15 +1071,10 @@
         # is the same later when displaying error contexts (regardless of EOL
         # chars used in the document).
 
-        if ($File->{'Direct Input'}) {
-            $ct .= "; charset=UTF-8";
-        }
-        else {
-            my @ct = ($File->{ContentType} => undef);
-            push(@ct, charset => $File->{Charset}->{HTTP})
-                if $File->{Charset}->{HTTP};
-            $ct = HTTP::Headers::Util::join_header_words(@ct);
-        }
+        my @ct = ($File->{ContentType} => undef);
+        push(@ct, charset => $File->{Charset}->{HTTP})
+            if $File->{Charset}->{HTTP};
+        $ct = HTTP::Headers::Util::join_header_words(@ct);
 
         $req->content_ref(\$File->{Bytes});
     }
Received on Monday, 12 December 2011 19:52:35 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 26 April 2012 12:55:31 GMT