W3C home > Mailing lists > Public > www-validator-cvs@w3.org > July 2007

validator/httpd/cgi-bin check,1.540,1.541

From: Olivier Thereaux via cvs-syncmail <cvsmail@w3.org>
Date: Thu, 19 Jul 2007 03:59:26 +0000
To: www-validator-cvs@w3.org
Message-Id: <E1IBNAk-0001LK-Ds@lionel-hutz.w3.org>

Update of /sources/public/validator/httpd/cgi-bin
In directory hutz:/tmp/cvs-serv3877/httpd/cgi-bin

Modified Files:
	check 
Log Message:
removing the list of supported character encodings, 
as we have a better and more reliable technical way to do this.

Replacing with a mechanism to:
* suggest a better alias if a "bad" encoding alias is used
* refuse to transcode if encoding used is forbidden by policy 
(I don't know any, but the mechanism is here...)

More details:
http://lists.w3.org/Archives/Public/public-qa-dev/2007Jul/0009.html
and surrounding thread.



Index: check
===================================================================
RCS file: /sources/public/validator/httpd/cgi-bin/check,v
retrieving revision 1.540
retrieving revision 1.541
diff -u -d -r1.540 -r1.541
--- check	17 Jul 2007 02:32:36 -0000	1.540
+++ check	19 Jul 2007 03:59:24 -0000	1.541
@@ -2083,19 +2083,25 @@
 
   my $cs = $exact_charset;
 
-  if (!$CFG->{Charsets}->{$cs}) {
-    # The encoding is not supported due to policy
-    # and possibly other reasons
-
-    $File->{'Error Flagged'} = TRUE;
-    $File->{Templates}->{Error}->param(fatal_transcode_error   => TRUE);
-    $File->{Templates}->{Error}->param(fatal_transcode_charset => $cs);
-
-    # @@FIXME might need better text
-    $File->{Templates}->{Error}->param(fatal_transcode_errmsg  =>
-                                       "Encoding not supported.");
+  if ($CFG->{Charsets}->{$cs}) {
+    if ($CFG->{Charsets}->{$cs} =~ /Encoding Forbidden/) {
+      # The encoding is not supported due to policy
+      
+      $File->{'Error Flagged'} = TRUE;
+      $File->{Templates}->{Error}->param(fatal_transcode_error   => TRUE);
+      $File->{Templates}->{Error}->param(fatal_transcode_charset => $cs);
 
-    return $File;
+      # @@FIXME might need better text
+      $File->{Templates}->{Error}->param(fatal_transcode_errmsg  =>
+                                         "This encoding is not supported by the validator.");
+      return $File;
+    }
+    else {
+      &add_warning('W22', {
+        W22_declared => $cs,
+        W22_suggested => $CFG->{Charsets}->{$cs},
+      });      
+    }
   }
 
   # Does the system support decoding this encoding?
Received on Thursday, 19 July 2007 03:59:28 GMT

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