Utility to translate HTML character entities into text?


#1

Anyone know of a Ruby utility that will translate HTML character
entities into text?

Thanks,
Wes


#2

Wes G. wrote:

Anyone know of a Ruby utility that will translate HTML character
entities into text?

Thanks,
Wes

http://www.ruby-doc.org/stdlib/libdoc/cgi/rdoc/classes/CGI.html#M000025

Unescape a string that has been HTML-escaped

CGI::unescapeHTML(“Usage: foo “bar” <baz>”)
# => "Usage: foo “bar” "


#3

On Fri, May 19, 2006 at 01:19:37AM +0200, Alex W. wrote:

CGI::unescapeHTML(“Usage: foo “bar” <baz>”)
# => "Usage: foo “bar” "

this seems to only decode lt, gt and amp entities:

irb(main):003:0> CGI::unescapeHTML(“élan”)
=> “élan”

you should have a look at http://htmlentities.rubyforge.org/ if you want
to decode other entities, too.

Jens