HTML entities problem with 5.11

Bill Simpson-Young (bill.simpson-young@cmis.csiro.au)
Fri, 05 Sep 1997 16:56:55 +1000


Hi. I've got a problem that has surfaced with the changes to 
HTML::Entities.pm for 5.11 (it doesn't happen with 5.08).  It's happening 
in the process of encoding then decoding special entities.  Eg, what goes 
in as "abc&def&ghi" comes out as "abc&def;&ghi;".

Here's the decode code from Entities.pm v1.9.

sub decode_entities
{
    my $array;
    if (defined wantarray) {
        $array = [@_]; # copy
    } else {
        $array = \@_;  # modify in-place
    }
    my $c;
    for (@$array) {
        s/(&\#(\d+);?)/$2 < 256 ? chr($2) : $1/eg;
        s/(&\#[xX]([0-9a-fA-F]+);?)/$c = hex($2); $c < 256 ? chr($c) : $1/eg;
        s/(&(\w+);?)/$entity2char{$2} || "$1;"/eg;
                                            ^ Am I missing something or this an unwanted semicolon?

Thanks,

Bill




-- 
Bill.Simpson-Young@cmis.csiro.au
CSIRO Mathematical and Information Sciences	http://www.cmis.csiro.au/
Bldg E6B Macquarie University                   tel: +61 2 9325 3155 
Locked Bag 17, North Ryde, NSW 2113, Australia  fax: +61 2 9325 3101