body = story.search(“//font[@color="#333333"]”).inner_html
body = body.gsub(/<(.|\n)+?>/, “”)
body = body.gsub(/�/, “'”)
puts body
body = Iconv.iconv(“utf8”, “tis-620”, body) #<-- this is line 37
puts body
Or try the following on irb
require ‘rubygems’
require ‘net/http’
require ‘open-uri’
require ‘iconv’
story =
Hpricot(open(‘http://thainews.prd.go.th/newsenglish/previewnews.php?news_id=255108040023’
))
body = story.search(“//font[@color="#333333"]”).inner_html
body = body.gsub(/<(.|\n)+?>/, “”)
body = body.gsub(/’/, “'”)
puts body
no matter whatever i put in the “’” it doesn’t replace anything and the
iconv still gives errors.
I am looking for pointers on one of the following.
how do i replace “’” to “'” ?
or 2) How can I make iconv ignore the “’” ?
At first I thought this to be a I18n issue, but i guess getting rid of
the special character would be a simple string manipulation which i dont
get.