Forum: Ruby convert htmlspecial characters using ruby

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
D4edc2843c07e2b50be5c0850bd47fd8?d=identicon&s=25 geetha (Guest)
on 2007-07-11 09:12
(Received via mailing list)
hi,

 I have to decode the html special character using ruby,
 if any function is there like php htmlspecialchars_decode ().


thanks,
sangeetha.S
87e41d0d468ad56a3b07d9a6482fd6d5?d=identicon&s=25 Hemant Kumar (gnufied)
on 2007-07-11 11:07
(Received via mailing list)
On 7/11/07, geetha <sangeetha.geethu05@gmail.com> wrote:
> hi,
>
>  I have to decode the html special character using ruby,
>  if any function is there like php htmlspecialchars_decode ().
>
>
> thanks,
> sangeetha.S
>

If you want to escape HTML special charcaters then i guess following
would work:

CGI::escapeHTML('Usage: foo "bar" <baz>')
     # => "Usage: foo &quot;bar&quot; &lt;baz&gt;"

If thats not what you want, please look into documentation of CGI
class and i think you would find method that you are looking for.
F0afd024e17c0c4753aa8d618ba9bb0f?d=identicon&s=25 Marcin Raczkowski (Guest)
on 2007-07-11 11:18
(Received via mailing list)
On Wednesday 11 July 2007 09:06, hemant wrote:
> If you want to escape HTML special charcaters then i guess following would
> work:
>
> CGI::escapeHTML('Usage: foo "bar" <baz>')
>      # => "Usage: foo &quot;bar&quot; &lt;baz&gt;"
>
> If thats not what you want, please look into documentation of CGI
> class and i think you would find method that you are looking for.
also ERB::h might help ^^
This topic is locked and can not be replied to.