# Open-URI and percent sign in url

**URL:** <https://www.ruby-forum.com/t/open-uri-and-percent-sign-in-url/115689>\
**Category:** Ruby\
**Created:** [September 27, 2007, 5:59pm UTC](https://www.ruby-forum.com/t/open-uri-and-percent-sign-in-url/115689 "2007-09-27T17:59:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [September 27, 2007, 5:59pm UTC](https://www.ruby-forum.com/t/open-uri-and-percent-sign-in-url/115689/1 "2007-09-27T17:59:39Z")

</div>

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](http://mitpress.mit.edu/sicp/full-text/book/book-Z-H-4.html#%25_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

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [September 27, 2007, 6:16pm UTC](https://www.ruby-forum.com/t/open-uri-and-percent-sign-in-url/115689/2 "2007-09-27T18:16:43Z")

</div>

On Sep 27, 2007, at 08:58 , removed\_email\_address@domain.invalid 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#%](http://mitpress.mit.edu/sicp/full-text/book/book-Z-H-4.html#%25)  
> \_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.

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [September 27, 2007, 6:26pm UTC](https://www.ruby-forum.com/t/open-uri-and-percent-sign-in-url/115689/3 "2007-09-27T18:26:07Z")

</div>

On Sep 27, 11:15 am, Eric H. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

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

Thanks. That worked!
