how to convert webpage apostrophe (’) to ascii 39 in ruby 1.8.7
Posted
by maninwarren
on Stack Overflow
See other posts from Stack Overflow
or by maninwarren
Published on 2010-05-11T17:01:59Z
Indexed on
2010/05/11
18:54 UTC
Read the original article
Hit count: 202
That's pretty much it. I'm using Nokogiri to scrape a web page what has ’ ; characters in it, and I can't figure out how to do the conversion. here's what I tried:
str.gsub(/’/,"'")
str.gsub("’","'")
str.gsub("GÇÖ","'") # that's how it looks when I do a puts
(In the above, there's no space between the ’ and the ";", but if I don't put the space in, SO converts it to an apostrophe -- the cruel, cruel irony!)
I'm sure this is covered somewhere, but couldn't find the solution here or on the web.
TIA
© Stack Overflow or respective owner