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.
geetha (Guest)
on 2007-07-11 11: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
Hemant K. (Guest)
on 2007-07-11 13:07
(Received via mailing list)
On 7/11/07, geetha <removed_email_address@domain.invalid> 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.
Marcin R. (Guest)
on 2007-07-11 13: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.