Re: Bug/Feature in HTML::Entities

Gisle Aas (aas@bergen.sn.no)
Mon, 08 Jul 1996 23:29:42 +0200


In message <m0udJFf-001sg6C@calder.med.miami.edu>, Michael Alan Dorman writes:
> As you can see, HTML::Entities is encoding $, which, according to my
> reading, is not the expected behavior.  The following patch solves the
> problem:
> 
> --- Entities.pm.~1~     Mon Jun  3 01:37:02 1996
> +++ Entities.pm Mon Jul  8 12:04:47 1996
> @@ -207,7 +207,7 @@
>         &{$subst{$_[1]}}($_[0]);
>      } else {
>         # Encode control chars, high bit chars and '<', '&', '>', '"'
> -       $_[0] =~ s/([^\n\t !#$%'-;=?-~])/$char2entity{$1}/g;
> +       $_[0] =~ s/([^\n\t !#\$%'-;=?-~])/$char2entity{$1}/g;
>      }
>      $_[0];
>  }

Thanks. Looks like a bug to me.  I guess we used to interpolate $%
into the regex, so both '$' and '%' got encoded when they should not
be.

Regards,
Gisle