From: Austin Ziegler Date: 2006-07-07T23:57:10+09:00 Subject: Re: URI.escape() broken or misdocumented in Ruby 1.8.4? On 7/6/06, Andrew Hodgkinson wrote: > I posted this in the Ruby On Rails forum a moment ago because of other > URI.escape() related messages there, but really it's a Ruby thing, not a > Rails thing, so it belongs in the Ruby forum. Thus, a repost :-) I don't have a clear answer to your question, below, but a couple of points that *MUST* be made: You are not posting to a forum with *either* the "Ruby on Rails 'forum'" or the "Ruby 'forum'". You are posting to a mailing list gateway. You are correct that this probably belongs on ruby-talk (the mailing list to which your post has been gatewayed) and comp.lang.ruby (the newsgroup to which the mailing list is bidirectionally gatewayed). But it's not a forum. It does appear to be a documentation bug or a code bug that was introduced; someone else will have to verify that. > I was going to update the documentation Wiki to mention the differing > behaviour in Ruby 1.8.4 by clicking on the link given at the bottom of > the page, which goes to: > > http://www.ruby-doc.org/ru/wiki/index.rb/Core/URI::Escape I didn't even know about this ;) I suspect that it's not filled because it's not how the documentation is dealt with in Ruby. Lastly, your example: p URI.escape("@?@!", Regexp.new("[!?]")) # => "@%3F@%21" Can be rewritten as: p URI.escape("@?@!", /[!?]/) You don't need Regexp.new. -austin -- Austin Ziegler * halostatue@gmail.com * http://www.halostatue.ca/ * austin@halostatue.ca * http://www.halostatue.ca/feed/ * austin@zieglers.ca