-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Thursday 05 December 2002 16:56, ahoward wrote: > rubyists- > > can any light be shed on why > > CGI.escape 'foo bar' >> "foo+bar" > > instead of > > CGI.escape 'foo bar' >> "foo%20bar" > > the '+' does not work under certain browser/apache conditions it seems. Judging by other responses, this is really a problem with your HTTP server. However, there is no reason we can't be accomodating. We do have the source code to cgi.rb available to us and this function is easily altered to do what you want. Here is the raw function from my /usr/local/lib/ruby/1.7/cgi.rb file: def CGI::escape(string) string.gsub(/([^ a-zA-Z0-9_.-]+)/n) do '%' + $1.unpack('H2' * $1.size).join('%').upcase end.tr(' ', '+') end Here is the change you need to make: def CGI::escape(string) string.gsub(/([^a-zA-Z0-9_.-]+)/n) do #delete the space '%' + $1.unpack('H2' * $1.size).join('%').upcase end #remove the tr method, which is no longer needed end If you don't have access to the cgi.rb file itself (or don't want to fiddle with the included libraries), you can always redefine this function in your own script by simply using it like so: class CGI def CGI::escape(string) .... the new definition end end Just do it after you require 'cgi' and your new method will replace the stock version. -michael -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.7 (GNU/Linux) iD8DBQE98Jqs4ClW9KMwqnMRAgCaAJ9gEgKzBmFnq8RDEmLLT5PgnoDk1gCfUVPp +6CGzNEEcH7TR+gf6y3v1JE= =kiW6 -----END PGP SIGNATURE-----