Bug in SGML parser

The sgml parser
/usr/local/lib/ruby/gems/1.8/gems/htmltools-1.10/lib/html/sgml-parser.rb
does not correctly handle character references. Yahoo sometimes
generates a character reference that looks like “’”. Firefox
displays this as a single quote. sgml-parser.rb raises an exception.

rescued: invalid value for Integer: “039” at Wed Dec 06 18:02:56 PST
2006
/usr/local/lib/ruby/gems/1.8/gems/htmltools-1.10/lib/html/sgml-parser.rb:335:in
Integer'/usr/local/lib/ruby/gems/1.8/gems/htmltools-1.10/lib/html/sgml-parser.rb:335:inhandle_charref’/usr/local/lib/ruby/gems/1.8/gems/htmltools-1.10/lib/html/sgml-parser.rb:159:in
goahead'/usr/local/lib/ruby/gems/1.8/gems/htmltools-1.10/lib/html/sgml-parser.rb:88:infeed’/usr/local/lib/ruby/gems/1.8/gems/rubyful_soup-1.0.4/lib/rubyful_soup.rb:547:in
`feed’/usr/local/lib/ruby/gems/1.8/gems/rubyful_soup-1.0.4/lib/rubyful_soup.rb

Possible fix: In handle_charref, strip leading zeroes from ‘name’
prior to calling ‘Integer’.