How to get rid of escaped characters

How do you get rid of unwanted escape characters that rails adds to a
user inputted string (e.g. like the forward slash in front of quotes,
etc.?"

Thanks,

Cheri

On Wed, 2008-01-30 at 23:59 +0100, Cheri R. wrote:

How do you get rid of unwanted escape characters that rails adds to a
user inputted string (e.g. like the forward slash in front of quotes,
etc.?"


doesn’t ‘h’ do that?

<%=h @some_array.value %>

Craig

Craig W. wrote:

On Wed, 2008-01-30 at 23:59 +0100, Cheri R. wrote:

How do you get rid of unwanted escape characters that rails adds to a
user inputted string (e.g. like the forward slash in front of quotes,
etc.?"


doesn’t ‘h’ do that?

<%=h @some_array.value %>

Craig

Thanks, but I want to get rid of them at the ruby level. - Cheri

On Thu, 2008-01-31 at 00:34 +0100, Cheri R. wrote:

Craig

Thanks, but I want to get rid of them at the ruby level. - Cheri


gsub

Craig

On 1/30/08, Craig W. [email protected] wrote:

Actually h (alias for html_escape) does just the reverse, sort of.

I think the OP might be a little confused since he talks about
inserting forward slashes in front of quotes. This sound like he’s
looking at the string in irb which uses inspect to display values, and
string.inspect presents the string as it would appear in a ruby
literal:

irb(main):002:0> str = “"To be or not to be" is the beginning of
Hamlet’s soliloquy”
=> “"To be or not to be" is the beginning of Hamlet’s soliloquy”
irb(main):003:0> puts str
“To be or not to be” is the beginning of Hamlet’s soliloquy
=> nil


Rick DeNatale

My blog on Ruby
http://talklikeaduck.denhaven2.com/