--- test/html-webhacc/cc.cgi 2007/11/11 06:57:16 1.24 +++ test/html-webhacc/cc.cgi 2007/11/23 12:08:32 1.29 @@ -52,7 +52,6 @@ $| = 0; my $input = get_input_document ($http, $dom); - my $inner_html_element = $http->get_parameter ('e'); my $char_length = 0; my %time; @@ -62,7 +61,12 @@
Request URI
<@{[htescape $input->{request_uri}]}>
Document URI
-
<@{[htescape $input->{uri}]}>
+
<@{[htescape $input->{uri}]}> +
]; # no yet push @nav, ['#document-info' => 'Information']; @@ -74,7 +78,7 @@
<@{[htescape $input->{base_uri}]}>
Internet Media Type
@{[htescape $input->{media_type}]} - @{[$input->{media_type_overridden} ? '(overridden)' : '']}
+ @{[$input->{media_type_overridden} ? '(overridden)' : defined $input->{official_type} ? $input->{media_type} eq $input->{official_type} ? '' : '(sniffed; official type is: '.htescape ($input->{official_type}).')' : '(sniffed)']}
Character Encoding
@{[defined $input->{charset} ? ''.htescape ($input->{charset}).'' : '(none)']} @{[$input->{charset_overridden} ? '(overridden)' : '']}
@@ -93,7 +97,8 @@ if ($input->{media_type} eq 'text/html') { ($doc, $el) = print_syntax_error_html_section ($input, $result); - print_source_string_section (\($input->{s}), $input->{charset}); + print_source_string_section + (\($input->{s}), $input->{charset} || $doc->input_encoding); } elsif ({ 'text/xml' => 1, 'application/atom+xml' => 1, @@ -247,8 +252,9 @@ my $doc = $dom->create_document; my $el; + my $inner_html_element = $http->get_parameter ('e'); if (defined $inner_html_element and length $inner_html_element) { - $input->{charset} ||= 'ISO-8859-1'; ## TODO: for now. + $input->{charset} ||= 'windows-1252'; ## TODO: for now. my $time1 = time; my $t = Encode::decode ($input->{charset}, $input->{s}); $time{decode} = time - $time1; @@ -264,6 +270,8 @@ ($input->{charset}, $input->{s} => $doc, $onerror); $time{parse_html} = time - $time1; } + $doc->manakai_charset ($input->{official_charset}) + if defined $input->{official_charset}; print STDOUT qq[]; @@ -304,6 +312,8 @@ my $doc = Message::DOM::XMLParserTemp->parse_byte_stream ($fh => $dom, $onerror, charset => $input->{charset}); $time{parse_xml} = time - $time1; + $doc->manakai_charset ($input->{official_charset}) + if defined $input->{official_charset}; print STDOUT qq[]; @@ -393,7 +403,7 @@ $r .= ''; @@ -414,6 +424,21 @@ } elsif ($nt == $child->DOCUMENT_NODE) { $r .= qq'
  • Document'; $r .= qq[