Unfortunately I don't make it.

I use mini test.


#!/usr/local/bin/ruby -w

ENV['REQUEST_METHOD'] = 'GET'
ENV['QUERY_STRING'] = 'query1=%7Evalue1&query2=value1&query2=value2'
ENV['HTTP_COOKIE'] = 'cookie1=%7Evalue1; cookie2=value1&value2'

require "cgi"
cgi = CGI.new

p CGI::parse('query1=%7Evalue1&query2=value1&query2=value2') ==
    {"query1"=>["~value1"], "query2"=>["value1", "value2"]}
p CGI::escape('!@$%^&*()') == '%21%40%24%25%5E%26%2A%28%29'
p CGI::unescape('%21%40%24%25%5E%26%2A%28%29') == '!@$%^&*()'
p CGI::escapeHTML('&"<>') == '&amp;&quot;&lt;&gt;'
p CGI::unescapeHTML('&amp;&quot;&lt;&gt;') == '&"<>'
p CGI::escapeElement('<HTML>', 'HTML') == '&lt;HTML&gt;'
p CGI::unescapeElement('&lt;HTML&gt;', 'HTML') == '<HTML>'
p cgi.params == {"query1"=>["~value1"], "query2"=>["value1", "value2"]}
p cgi.cookies["cookie1"] == ["~value1"] and
    cgi.cookies["cookie2"] == ["value1", "value2"]

etc...


-- 
Wakou Aoyama  <wakou / fsinet.or.jp>