My cgi.d module does more comprehensive stuff: http://arsdnet.net/dcode/cgi.d Look for decodeVariables and encodeVariables. They are pretty trivial function - split on the &, then decode each part.