Forum: Ruby URI parsing barfs on '^'

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Ad7805c9fcc1f13efc6ed11251a6c4d2?d=identicon&s=25 Alex Young (Guest)
on 2006-05-06 11:57
(Received via mailing list)
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:

  http://uk.finance.yahoo.com/q/cp?s=FTSE

This URI doesn't parse, and is correct:

  http://uk.finance.yahoo.com/q/cp?s=^FTSE

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?
Faf3b56a44269e2c5b92cf97435e29f6?d=identicon&s=25 PA (Guest)
on 2006-05-06 13:04
(Received via mailing list)
On May 06, 2006, at 11:55, Alex Young 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

Cheers
Ad7805c9fcc1f13efc6ed11251a6c4d2?d=identicon&s=25 Alex Young (Guest)
on 2006-05-06 13:07
(Received via mailing list)
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
Gotcha.  Thought it'd be something obvious...
This topic is locked and can not be replied to.