--- test/html-webhacc/cc.cgi 2008/05/06 08:47:09 1.50 +++ test/html-webhacc/cc.cgi 2008/05/18 03:47:56 1.51 @@ -677,11 +677,28 @@ my $input = shift; my $s; unless ($input->{is_char_string}) { - require Encode; - my $enc = Encode::find_encoding ($_[1]); ## TODO: charset name -> Perl name - return unless $enc; + open my $byte_stream, '<', $_[0]; + require Message::Charset::Info; + my $charset = Message::Charset::Info->get_by_iana_name ($_[1]); + my ($char_stream, $e_status) = $charset->get_decode_handle + ($byte_stream, allow_error_reporting => 1, allow_fallback => 1); + return unless $char_stream; + + $char_stream->onerror (sub { + my (undef, $type, %opt) = @_; + if ($opt{octets}) { + ${$opt{octets}} = "\x{FFFD}"; + } + }); - $s = \($enc->decode (${$_[0]})); + my $t = ''; + while (1) { + my $c = $char_stream->getc; + last unless defined $c; + $t .= $c; + } + $s = \$t; + ## TODO: Output for each line, don't concat all of lines. } else { $s = $_[0]; } @@ -1182,24 +1199,25 @@ print STDOUT qq[$label$result->{$_->[1]}->{must}$uncertain$result->{$_->[1]}->{should}$uncertain$result->{$_->[1]}->{warning}$uncertain]; if ($uncertain) { - print qq[−∞..$result->{$_->[1]}->{score_max}]; + print qq[−∞..$result->{$_->[1]}->{score_max}]; } elsif ($result->{$_->[1]}->{score_min} != $result->{$_->[1]}->{score_max}) { - print qq[$result->{$_->[1]}->{score_min}..$result->{$_->[1]}->{score_max}]; + print qq[$result->{$_->[1]}->{score_min}..$result->{$_->[1]}->{score_max}]; } else { - print qq[$result->{$_->[1]}->{score_min}]; + print qq[$result->{$_->[1]}->{score_min}]; } + print qq[ / 20]; } $score_max += $score_base; print STDOUT qq[ -Semantics0?0?0?−∞..$score_base +Semantics0?0?0?−∞..$score_base / 20 Total $must_error? $should_error? $warning? -−∞..$score_max +−∞..$score_max / 100

Important: This conformance checking service @@ -1623,4 +1641,4 @@ =cut -## $Date: 2008/05/06 08:47:09 $ +## $Date: 2008/05/18 03:47:56 $