Open-URI and percent sign in url

Discussion in 'Ruby' started by lrlebron@gmail.com, Sep 27, 2007.

  1. Guest

    I am trying to use open-uri to open the following url
    http://mitpress.mit.edu/sicp/full-text/book/book-Z-H-4.html#%_toc_start
    and I'm getting the following error

    :/ruby/lib/ruby/1.8/uri/common.rb:436:in `split': bad URI(is not
    URI?): http://mitpress.mit.edu/sicp/full-text/book/book-Z-H-4.html#%_toc_start
    (URI::InvalidURIError)
    from c:/ruby/lib/ruby/1.8/uri/common.rb:485:in `parse'
    from c:/ruby/lib/ruby/1.8/open-uri.rb:29:in `open'
    from mitbook.rb:14

    However, the url works fine in the browser.


    thanks,

    Luis
     
    , Sep 27, 2007
    #1
    1. Advertising

  2. Eric Hodel Guest

    On Sep 27, 2007, at 08:58 , wrote:

    > I am trying to use open-uri to open the following url
    > http://mitpress.mit.edu/sicp/full-text/book/book-Z-H-4.html#%
    > _toc_start
    > and I'm getting the following error


    %_t is not a valid % escape sequence. You probably want ...#%25_toc...

    > However, the url works fine in the browser.


    The browser is more forgiving, which is nice for people like my parents.
     
    Eric Hodel, Sep 27, 2007
    #2
    1. Advertising

  3. Guest

    On Sep 27, 11:15 am, Eric Hodel <> wrote:
    > On Sep 27, 2007, at 08:58 , wrote:
    >
    > > I am trying to use open-uri to open the following url
    > >http://mitpress.mit.edu/sicp/full-text/book/book-Z-H-4.html#%
    > > _toc_start
    > > and I'm getting the following error

    >
    > %_t is not a valid % escape sequence. You probably want ...#%25_toc...
    >
    > > However, the url works fine in the browser.

    >
    > The browser is more forgiving, which is nice for people like my parents.


    Thanks. That worked!
     
    , Sep 27, 2007
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    13
    Views:
    53,352
    John Machin
    Sep 26, 2006
  2. Joey Martin

    Passing percent sign in querystring

    Joey Martin, Apr 22, 2005, in forum: ASP General
    Replies:
    11
    Views:
    1,637
    Bob Barrows [MVP]
    Apr 22, 2005
  3. Replies:
    2
    Views:
    179
  4. Jay 99
    Replies:
    2
    Views:
    192
    Jay 99
    Apr 4, 2009
  5. Bartek Lakomiec
    Replies:
    4
    Views:
    242
    Eric Schwartz
    Apr 5, 2007
Loading...

Share This Page