Solved

stupid NS won't pass white spaces

Posted on 2002-06-10
6
163 Views
Last Modified: 2010-03-05
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;
}
0
Comment
Question by:celere
6 Comments
 
LVL 51

Accepted Solution

by:
ahoffmann earned 50 total points
ID: 7067770
you need to write
    script.cgi?apl::Apple Recipes
as
    script.cgi?apl::Apple%20Recipes
0
 
LVL 12

Expert Comment

by:lexxwern
ID: 7069024
some servers have + as spaces. check what your server does.
0
 
LVL 6

Expert Comment

by:andreif
ID: 7069249
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>
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 12

Expert Comment

by:lexxwern
ID: 7069298
good catch andreif
0
 

Author Comment

by:celere
ID: 7069664
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.
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 7070038
> .. I don't really believe  ..
it works for some browsers (mainly M$ adicted ones)
but read w3c standards: it's not recommended
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

There are many situations when we need to display the data in sorted order. For example: Student details by name or by rank or by total marks etc. If you are working on data driven based projects then you will use sorting techniques very frequently.…
In the distant past (last year) I hacked together a little toy that would allow a couple of Manager types to query, preview, and extract data from a number of MongoDB instances, to their tool of choice: Excel (http://dilbert.com/strips/comic/2007-08…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now