1
你好,我有URL編碼,%3A,%2F的串...字符串URL編碼
的http%3A%2F%2Fmydomain.com%2Fimage%2Fflv%2F1%2F8%2FA% 2Fimage_18060.jpg%3Fe%3D13777194
我想將「特殊字符」http://www.w3schools.com/tags/ref_urlencode.asp替換爲ASCII字符,我在Rails中編程,但我沒有想法,我可以從哪裏開始。你有什麼想法?
非常感謝您的幫助!
hummm 這樣我可以使用URI.unescape嗎?
scraper = Scraper.define do
array :items
process "div.mozaique>div", :items => Scraper.define {
process "div.thumb>a", URI.unescape(:link) => "@href"
result :link
}
result :items
end
/Users/jcr/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/uri/common.rb:331:in `unescape': undefined method `gsub' for :link:Symbol (NoMethodError)
from /Users/jcr/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/uri/common.rb:649:in `unescape'
from /Users/jcr/web/sss/app/controllers/cweb.rb:17:in `block (2 levels) in main_web'
from /Users/jcr/.rvm/gems/ruby-1.9.3-p448/gems/scrapi-2.0.0/lib/scraper/base.rb:986:in `module_eval'
from /Users/jcr/.rvm/gems/ruby-1.9.3-p448/gems/scrapi-2.0.0/lib/scraper/base.rb:986:in `define'
from /Users/jcr/web/sss/app/controllers/cweb.rb:15:in `block in main_web'
from /Users/jcr/.rvm/gems/ruby-1.9.3-p448/gems/scrapi-2.0.0/lib/scraper/base.rb:986:in `module_eval'
from /Users/jcr/.rvm/gems/ruby-1.9.3-p448/gems/scrapi-2.0.0/lib/scraper/base.rb:986:in `define'
from /Users/jcr/web/sss/app/controllers/cweb.rb:13:in `main_web'
from /Users/jcr/web/sss/app/controllers/cweb.rb:57:in `<top (required)>'
from -e:1:in `load'
from -e:1:in `<main>'