Bug/Feature in HTML::Entities

Michael Alan Dorman (mdorman@calder.med.miami.edu)
Mon, 08 Jul 1996 12:33:34 -0400


I have HTML::Entities 1.6.  The following script and its output
shows the problem:

-----8<-----
#!/usr/bin/perl

use HTML::Entities;

$a = '$';
print "$a\n";
encode_entities ( $a );
print "$a\n";
----->8-----

$ perl ~mdorman/test.pl
$
&#36;

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];
 }

If this is, in fact, correct behavior, then the docs need to be
changed, since they don't specify this.

Mike.
--
Michael Alan Dorman                                   Head of Systems
mdorman@caldmed.med.miami.edu           Louis Calder Memorial Library
(305) 243-5530                 University of Miami School of Medicine