All characters that aren't alphanumeric must be changed to their hexadecimal equivalent. Try this code:
/g {
var %a = $1-
while ($regex(a,%a,/([^% \w])/Sg)) {
%a = $replace(%a,$regml(a,1),% $+ $base($asc($regml(a,1)),10,16))
if ($calc($len(%a) $+ 2) > 800) break
}
say
http://www.google.com/search?q= $+ $replace(%a,$chr(32),+)
}
(untested)
-genius_at_work