Link to home
Start Free TrialLog in
Avatar of celere
celere

asked on

stupid NS won't pass white spaces

Argh here we go again.

I've already tried the two solutions posted at qid=20217126.  They worked before, but they don't work today.

I have HREFs, form submission, and javascript <select> redirection all using the same format:

<a href="http://www.mysite.com/cgi/script.cgi?apl::Apple Recipes>Apple Recipes</a>

Then my perl script delimits the query:

$page=$ENV{'QUERY_STRING'};
$page=~s/^page=//;

foreach($page){
  ($shortname,$longname)=split(/::/,$_);
  }

Without fail, NS drops the second part of $longname, and prints only Apple.

Like I said, this was once resolved in qid=20217126 and today I tried both of those solutions. Neither one is working now.

Can you please help me? Thank you thank you thank you.

PS- the solutions offered at 20217126 are:

(1) $company =~ s/ /%20/g;

and

(2)
$company=&my_escape($company);
...

sub my_escape{
 my($text)=@_;
 # Build a char->hex map
 for (0..255) {
   $escapes{chr($_)} = sprintf("%%%02X", $_);
 }
 ##  Regular expression for escaping special chars.
 $text =~ s/([^;\/?:@&=+\$,A-Za-z0-9\-_.!~*'()])/$escapes{$1}/g;

 return $text;
}
ASKER CERTIFIED SOLUTION
Avatar of ahoffmann
ahoffmann
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
some servers have + as spaces. check what your server does.
There is missing quote:

<a href="http://www.mysite.com/cgi/script.cgi?apl::Apple Recipes>Apple Recipes</a>

should read as

<a href="http://www.mysite.com/cgi/script.cgi?apl::Apple Recipes">Apple Recipes</a>
good catch andreif
Avatar of celere
celere

ASKER

Thanks everyone. Actually that missing closing quote was just a typo here in my post.  My links all had all quotes. And while I don't really believe that hard coding the %20's is the solution (like I said, this worked before), I've resorted to it for now. Thanks again.
> .. I don't really believe  ..
it works for some browsers (mainly M$ adicted ones)
but read w3c standards: it's not recommended