From: Rob Biedenharn Date: 2009-08-29T01:12:11+09:00 Subject: Re: Found a ruby bug in the URI class, what do I do? Sorry, Victor, but yes it does. Quoting from the end of RFC 2396 section 2.4.3: [quote] Other characters are excluded because gateways and other transport agents are known to sometimes modify such characters, or they are used as delimiters. unwise = "{" | "}" | "|" | "\" | "^" | "[" | "]" | "`" Data corresponding to excluded characters must be escaped in order to be properly represented within a URI. [/quote] So that last sentence pretty much nails it. Curly braces "...must be escaped in order to be properly represented within a URI." So you'll have to continue to escape them yourself. It wouldn't be right for the URI class to depart from the standard here. -Rob On Aug 28, 2009, at 11:40 AM, Victor Pereira wrote: > Rob, > > to be in the 'unwise' doesn't mean > that it not conforms to the standard for URIs. > > I'm escaping and it works, but in my option it could be handled by the > lib. > > VP > > Rob Biedenharn wrote: >> On Aug 27, 2009, at 10:31 AM, Michael Fellinger wrote: >> >>>> URI::InvalidURIError: bad URI(is not URI?): >>>> That's a strange ID but valid. I even checked the RFC 2396 and {} >>>> is not >>>> a reserved character. >> >> But it is part of the 'unwise' set defined by RFC 2396 in: >> "2.4.3. Excluded US-ASCII Characters >> Although they are disallowed within the URI syntax, we include >> here a description of those US-ASCII characters that have been >> excluded and the reasons for their exclusion." >> http://www.faqs.org/rfcs/rfc2396.html >> >> Just because a URI works in any (or even all) browser(s) doesn't mean >> that it conforms to the standard for URIs. >> >> I think that URI.split is doing the right thing. >> >> URI.escape() might be a workaround for you: >> >> irb> u="http://xpto.com/index.asp? >> action=showproduct&id={D3E21D33-6DFF-4355-9324-AE1395CEB247}" >> => "http://xpto.com/index.asp? >> action=showproduct&id={D3E21D33-6DFF-4355-9324-AE1395CEB247}" >> irb> URI.escape(u) >> => >> "http://xpto.com/index.asp?action=showproduct&id=%7BD3E21D33-6DFF-4355-9324-AE1395CEB247%7D >> " >> irb> u1=URI.parse(URI.escape(u)) >> => #> URL:http://xpto.com/index.asp?action=showproduct&id=%7BD3E21D33-6DFF-4355-9324-AE1395CEB247%7D >>> >> irb> u1.query >> => "action=showproduct&id=%7BD3E21D33-6DFF-4355-9324-AE1395CEB247%7D" >> irb> URI.unescape(u1.query) >> => "action=showproduct&id={D3E21D33-6DFF-4355-9324-AE1395CEB247}" >> >> >> -Rob >> >>> >>> -- >>> Michael Fellinger >>> CTO, The Rubyists, LLC >>> 972-996-5199 >>> >> >> Rob Biedenharn http://agileconsultingllc.com >> Rob@AgileConsultingLLC.com > > -- > Posted via http://www.ruby-forum.com/. > Rob Biedenharn http://agileconsultingllc.com Rob@AgileConsultingLLC.com +1 513-295-4739 Skype: rob.biedenharn