Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > library for doing html escaping...

Reply
Thread Tools

library for doing html escaping...

 
 
Sean T Allen
Guest
Posts: n/a
 
      04-29-2005
--------------090403080404050404020301
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

ruby forge drives me crazy trying to find things...

need a library that provides simple functionality of take a string and
doing html escaping

" to "
& to &

etc.

suggestions....

--------------090403080404050404020301
Content-Type: text/x-vcard; charset=utf-8;
name="sean.vcf"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename="sean.vcf"

begin:vcard
fn:Sean T. Allen
n:Allen;Sean T.
org:Ardis Marketing Group
adr;dom:;;;New York;NY
email;internet:(E-Mail Removed)
title:Tech Guru
x-mozilla-html:FALSE
url:http://ardismg.com/
version:2.1
end:vcard


--------------090403080404050404020301--


 
Reply With Quote
 
 
 
 
Phlip
Guest
Posts: n/a
 
      04-29-2005
Sean T Allen wrote:

> ruby forge drives me crazy trying to find things...


Sometimes what you seek was obvious to everyone else, so they didn't
excessively document it. Sorry.

> need a library that provides simple functionality of take a string and
> doing html escaping
>
> " to "
> & to &


require 'cgi'
....

def test_escapeHTML()
scream = CGI::escapeHTML(">scream<")
assert_equal(scream, '&gt;scream&lt;')
end

--
Phlip
http://www.c2.com/cgi/wiki?ZeekLand


 
Reply With Quote
 
 
 
 
Ara.T.Howard@noaa.gov
Guest
Posts: n/a
 
      04-29-2005
On Sat, 30 Apr 2005, Sean T Allen wrote:

> --------------090403080404050404020301
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
> Content-Transfer-Encoding: 7bit
>
> ruby forge drives me crazy trying to find things...
>
> need a library that provides simple functionality of take a string and
> doing html escaping
>
> " to &quot;
> & to &amp;
>
> etc.
>
> suggestions....
>


it's builtin to ruby:

harp:~ > irb -r cgi
irb(main):001:0> CGI::escapeHTML %Q( " )
=> " &quot; "
irb(main):002:0> CGI::escapeHTML %Q( & )
=> " &amp; "
irb(main):003:0> CGI::escapeHTML %Q( < )
=> " &lt; "
irb(main):004:0> CGI::escapeHTML %Q( > )
=> " &gt; "

cheers.
-a
--
================================================== =============================
| email :: ara [dot] t [dot] howard [at] noaa [dot] gov
| phone :: 303.497.6469
| renunciation is not getting rid of the things of this world, but accepting
| that they pass away. --aitken roshi
================================================== =============================

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
.html, what am I doing wrong? Joe Magiera HTML 7 07-04-2011 01:54 PM
Re: [OT, maybe] C library for doing graphics Beej Jorgensen C Programming 2 07-18-2009 08:03 PM
Re: [OT, maybe] C library for doing graphics bartc C Programming 5 07-18-2009 03:04 PM
doing math with html lrbtav HTML 10 05-24-2007 09:03 AM
Can i have an image button doing the functionality of file input of html Mathew George ASP .Net Datagrid Control 0 09-15-2003 05:37 AM



Advertisments