From: Alan Chen Date: 2002-10-22T01:24:32+09:00 Subject: Re: URI bug or bad URI? On Mon, Oct 21, 2002 at 08:05:46PM +0900, Brian Candler wrote: > On Sun, Oct 20, 2002 at 08:24:07PM +0900, akira yamada wrote: > > > > >>>>> In [ruby-talk : No.53493] > > >>>>> Alan Chen wrote: > > > mailto = URI.new( 'mailto:user@domain.com?subject=test%20(@test=10) > > > > > > Are '@' symbols allowed in uri's in this context or do they need to be > > > escaped? > > > > '@' is OK. But '=' cannot be put in hvalue. I think that 'subject: > > test (@test=10)' should be written as 'subject=test%20(@test%3D10)' in > > URI. > > RFC2368: ``Note that all URL reserved characters in "to" must be encoded: > in particular, parentheses, commas, and the percent sign ("%"), which > commonly occur in the "mailbox" syntax. > > "hname" and "hvalue" are encodings of an RFC 822 header name and > value, respectively. As with "to", all URL reserved characters must > be encoded.'' > > But that conflicts with RFC1738 which explicitly allows parentheses and > commas as unreserved characters which can always be used unencoded in a URL. > Grr. > > Anyway, if you want to err on the safe side, you might choose > > subject=test%20%28@test%3D10%29 I really wan't choosing this uri encoding, it was something that my application encountered "in the wild" of the internet. I guess I can write some sort of pre-filter for the URI or add some code to extend URI.parse. Maybe I'll modify it for URI.parse(uristring, parsetype) where parsetype could be :rfc2368, :rfc1738, :rfc2368_lax or similiar. -- Alan Chen Digikata LLC http://digikata.com