1

こんにちは、 URL-ENCODING 、 %3A 、 %2F を含む文字列があります ...

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でプログラミングしていますが、どこから始めればよいかわかりません。あなたはなにか考えはありますか?

ご助力ありがとうございます!


うーん、このように 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>'
4

1 に答える 1