# URI parsing barfs on '^'

**URL:** <https://www.ruby-forum.com/t/uri-parsing-barfs-on/94547>\
**Category:** Ruby\
**Created:** [May 6, 2006, 11:57am UTC](https://www.ruby-forum.com/t/uri-parsing-barfs-on/94547 "2006-05-06T11:57:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![regularfry](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/45deac/32.png) [@regularfry](https://www.ruby-forum.com/u/regularfry)\
**Post date:** [May 6, 2006, 11:57am UTC](https://www.ruby-forum.com/t/uri-parsing-barfs-on/94547/1 "2006-05-06T11:57:42Z")

</div>

Hi there,

I’ve got a URL that appears valid, but that URI.parse breaks on. I’m  
not sure what’s correct here. This URI parses, but is wrong:

[Symbol lookup from Yahoo Finance](http://uk.finance.yahoo.com/q/cp?s=FTSE)

This URI doesn’t parse, and is correct:

[FTSE 100 (^FTSE) components – Yahoo Finance](http://uk.finance.yahoo.com/q/cp?s=%5EFTSE)

The question is, should ‘^’ need to be quoted? It’s not named as a  
reserved character in RFC 3986, which I _think_ is the most recent URI  
definition, so shouldn’t URI.parse be able to handle it?

---

<div class="post-metadata">

**Author:** ![regularfry](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/45deac/32.png) [@regularfry](https://www.ruby-forum.com/u/regularfry)\
**Post date:** [May 6, 2006, 1:04pm UTC](https://www.ruby-forum.com/t/uri-parsing-barfs-on/94547/2 "2006-05-06T13:04:31Z")

</div>

On May 06, 2006, at 11:55, Alex Y. wrote:

> The question is, should ‘^’ need to be quoted? It’s not named as a  
> reserved character in RFC 3986, which I _think_ is the most recent URI  
> definition, so shouldn’t URI.parse be able to handle it?

My guess is that Ruby’s URI parser takes its inspiration from RFC 2396,  
which uri/common.rb refers to:

2.4.3. Excluded US-ASCII Characters

```
unwise = "{" | "}" | "|" | "\" | "^" | "[" | "]" | "`"

Data corresponding to excluded characters must be escaped in order 

```

to  
be properly represented within a URI.

[http://www.ietf.org/rfc/rfc2396.txt](http://www.ietf.org/rfc/rfc2396.txt)

Cheers

---

<div class="post-metadata">

**Author:** ![regularfry](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/45deac/32.png) [@regularfry](https://www.ruby-forum.com/u/regularfry)\
**Post date:** [May 6, 2006, 1:07pm UTC](https://www.ruby-forum.com/t/uri-parsing-barfs-on/94547/3 "2006-05-06T13:07:42Z")

</div>

PA wrote:

> 2.4.3. Excluded US-ASCII Characters
> 
> unwise = “{” | “}” | “|” | "" | “^” | “[” | “]” | “`”
> 
> Data corresponding to excluded characters must be escaped in order to  
> be properly represented within a URI.
> 
> [http://www.ietf.org/rfc/rfc2396.txt](http://www.ietf.org/rfc/rfc2396.txt)  
> Gotcha. Thought it’d be something obvious…
