The URI::Escape module works great.  Takes care of the spaces and the #.  Thanks for 
the help.

Stanley G. Martin
Midwest Consulting Group
Sprint Platform & Strategy Mgmt
913.315.3133
[EMAIL PROTECTED]

 -----Original Message-----
From:   Home [mailto:[EMAIL PROTECTED]] 
Sent:   Thursday, March 08, 2001 9:04 AM
To:     stanley.g.martin
Cc:     Home; perl-win32-web
Subject:        Re: Passing Arguments w/#

Are you really including a space in the URI?
Never do that: %20 instead: see `perldoc perlfaq9`:

   How do I decode or create those %-encodings on the web?

     Here's an example of decoding:

         $string = 
"http://altavista.digital.com/cgi-bin/query?pg=q&what=news&fmt=.&q=%2Bcgi-bin+%2Bperl.exe";
         $string =~ s/%([a-fA-F0-9]{2})/chr(hex($1))/ge;

     Encoding is a bit harder, because you can't just blindly change all the
     non-alphanumunder character (`\W') into their hex escapes. It's
     important that characters with special meaning like `/' and `?' *not* be
     translated. Probably the easiest way to get this right is to avoid
     reinventing the wheel and just use the URI::Escape module, available
     from CPAN.


HTH
Lee

At 08:57 08/03/01 -0600, [EMAIL PROTECTED] wrote:
>I have a CGI program that I want to pass a field as an argument in a
>link that has a # (pound sign) in it.  When it gets to the next page,
>anything after the # is truncated as if it is a comment.
>
>Example:
>
>Backup #1   Comes across as just    Backup
>
>I don't know if this is a regex question or not but how can I get my
>script to disregard that #?
>
>Stanley G. Martin
>Midwest Consulting Group
>Sprint Platform & Strategy Mgmt
>913.315.3133
>[EMAIL PROTECTED]

Lee Goddard  <mailto:[EMAIL PROTECTED]>
________________________________________________________

Perl / XML / XSLT / Java / JavaScript / HTML / etc

Reply via email to