Re: Preparing for validator 0.8.6 release

Le 8 déc. 2009 à 04:21, Michael(tm) Smith a écrit :
> Does it include a fix for bug 5592 (Validator ignores HTML5 encoding declaration)?
> 
>  http://www.w3.org/Bugs/Public/show_bug.cgi?id=5992

not yet.

http://search.cpan.org/dist/HTML-Encoding/lib/HTML/Encoding.pm
source code: http://cpansearch.perl.org/src/BJOERN/HTML-Encoding-0.60/lib/HTML/Encoding.pm


A bit of logic to add here:


sub encoding_from_meta_element
{
# …

    foreach (grep { $_->[0] eq "meta" } @$meta)
    {
        my %hash = %{$_->[1]};
        next unless defined $hash{'content'} ;
        next unless lc $hash{'http-equiv'} eq "content-type";
        my $char = encoding_from_content_type($hash{'content'});
        push @resu, $char if defined $char and length $char;
    }
# …
}

would something like this be ok: (my perl is rusty)


    foreach (grep { $_->[0] eq "meta" } @$meta)
    {
        my %hash = %{$_->[1]};
	if (next unless defined $hash{'content'})
     	{
	    next unless lc $hash{'http-equiv'} eq "content-type";
            my $char = encoding_from_content_type($hash{'content'});
        }
	else
        {
	    my $char = encoding_from_content_type($hash{'charset'})
        }
        push @resu, $char if defined $char and length $char;
    }




-- 
Karl Dubost
Montréal, QC, Canada
http://www.la-grange.net/karl/

Received on Tuesday, 8 December 2009 11:58:12 UTC