Re: CGI URLs in HREFs (was Re: An smtp URL scheme)

Walter Ian Kaye (walter@natural-innovations.com)
Sun, 13 Jul 1997 01:26:01 -0700


Message-Id: <v0310285fafee403738bf@[205.149.180.135]>
In-Reply-To: <v0310285eafee2a020172@[205.149.180.135]>
Date: Sun, 13 Jul 1997 01:26:01 -0700
To: www-html@w3.org
From: Walter Ian Kaye <walter@natural-innovations.com>
Subject: Re: CGI URLs in HREFs (was Re: An smtp URL scheme)

At 12:07a -0700 07/13/97, Walter Ian Kaye wrote:
 >
 > So, I guess I'll have to update my 'wiklib.pl' library to check for
 > semicolons instead of just assuming ampersands. Now to come up with
 > a good algorithm. How about this:
 >
 >   1. Count number of '='s in query string.
 >   2. If more than one, determine whether '&' or ';' is used as field
 >      separator:
 >
 >      ??? Extract substring from first '=' to second '=', then count
 >          number of '&'s and ';'s, and compare counts. ???
 >
 >   3. Split accordingly.
 >
 > That oughta do it, eh?

Perl code (as yet untested) now looking like this:

   $query =~ s/\r\n$//;                 # delete any trailing CRLF.
   $sep = '&';
   @eqarr = split(/=/,$query);
   $fields = scalar(@eqarr) - 1;
   if ($fields > 1) {
      $eqstr = @eqarr[1];
      $amptot = scalar(split(/&/,$eqstr)) - 1;
      $semtot = scalar(split(/;/,$eqstr)) - 1;
      if ($semtot && $semtot > $amptot) {
         $sep = ';';
         }
      }
   @query = split($sep,$query);

That look ok?

__________________________________________________________________________
  Walter Ian Kaye <boo_at_best*com>    Programmer - Excel, AppleScript,
          Mountain View, CA                         ProTERM, FoxPro, HTML
 http://www.natural-innovations.com/     Musician - Guitarist, Songwriter