Wes Gamble
2006-May-18 21:28 UTC
[Rails] Utility to translate HTML character entities into text?
Anyone know of a Ruby utility that will translate HTML character entities into text? Thanks, Wes -- Posted via http://www.ruby-forum.com/.
Alex Wayne
2006-May-18 23:19 UTC
[Rails] Re: Utility to translate HTML character entities into text?
Wes Gamble wrote:> Anyone know of a Ruby utility that will translate HTML character > entities into text? > > Thanks, > Weshttp://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\" <baz>" -- Posted via http://www.ruby-forum.com/.
Jens Kraemer
2006-May-22 18:10 UTC
[Rails] Re: Utility to translate HTML character entities into text?
On Fri, May 19, 2006 at 01:19:37AM +0200, Alex Wayne wrote:> Wes Gamble 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\" <baz>"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 -- Jens Kr?mer jk@jkraemer.net