Anyone know of a Ruby utility that will translate HTML character
entities into text?
Thanks,
Wes
Anyone know of a Ruby utility that will translate HTML character
entities into text?
Thanks,
Wes
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" ”
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
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs