HTML::Element bug or flaw ?

Sebastien Barre (Sebastien.Barre@utc.fr)
Mon, 12 Jul 1999 11:11:50 +0200


I was wondering about the HTML::Element::as_HTML code :

sub as_HTML
{
    my $self = shift;
    my @html = ();
    $self->traverse(
        sub {
	    my($node, $start, $depth) = @_;
	    if (ref $node) {
		my $tag = $node->tag;
		if ($start) {
		    push(@html, $node->starttag);
		} elsif (not ($emptyElement{$tag} or $optionalEndTag{$tag})) {
		    push(@html, $node->endtag);
		}
	    } else {
		# simple text content
		HTML::Entities::encode_entities($node, "<>&");
		push(@html, $node);
	    }
[...]

In simple text content, when calling HTML::Entities::encode_entities, why
constraining the conversion to "<>&" ? This will encode (<, >, &) as (&lt;,
&gt;, &amp;) but will disable all other conversions, especially these
related to accuented chars. I guess this might be a design choice, but what
was the rational behind it ?

Thanks a lot
(and thanks for the LWP :)


______________________________________________________________
Sebastien Barre                  http://www.hds.utc.fr/~barre/