[Laszlo-dev] Re: [Dev] javascript routine for converting CGI query string into key-value array?

Pablo Kang pkang at laszlosystems.com
Thu Jan 27 22:27:41 PST 2005


Oliver Steele wrote:

>
> function unquoteQueryValue(s) {
>   if (s.indexOf('%') < 0) return s; // fast path
>   var spans = s.split('%');
>   var accum; // initialized first time through
>   for (var i in spans) {
>     var span = spans[i];
>     if (i == 0) {
>       accum = span;
>     } else {
>       accum += String.fromCharCode(parseInt(span.substring(0, 2), 16));
>       accum += span.substring(2);
>     }
>   }
>   return accum;
> }
>
> but it's worth looking to see whether there's a Flash API for 
> unquoteQueryValue(), both for speed and because my version isn't 
> tested or finished (it doesn't check for malformed content such as 
> '%%%', or '%3' at the end of a string).

I believe there's unescape().

pablo


More information about the Laszlo-dev mailing list