Solved

more help with spaces, please (the '%20's are breeding!)

Posted on 2002-06-13
6
161 Views
Last Modified: 2010-03-05
Okay so this works:

$location =~ s/ /%20/g;

if I take it out, it doesn't work (in Netscape, but IE is fine).

However, it is replacing a single space with THREE '%20's

So that what should be "new york" comes out as "new%20%20%20york" on one page....

But wait there's more (no pun intended)!
On the next page there are 9 of them! they are multiplying by three!

New%20%20%20%20%20%20%20%20%20York

The script works nonetheless, but this is really messy.

Anyone know why it's doing this, and how I can fix it?

Thank you.

0
Comment
Question by:celere
  • 4
6 Comments
 
LVL 3

Accepted Solution

by:
Tsvetomir earned 50 total points
ID: 7076049
... check my comment to your other post
0
 
LVL 1

Expert Comment

by:BigJoe1008
ID: 7097870
For starters

use CGI;
use strict;

CGI will parse out the %20s for you and put spaces there.
Secondly use Tsvetomir's comment and use:

$location =~ s/\s+/\%20/g;

--Joe
0
 

Author Comment

by:celere
ID: 7100833
Thanks I'm still trying. It won't let me
use strict;

it returns:

Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.

If I remove strict the script still executes but stupid NS is still screwing up.

I will give ALL 465 of my points to the first person who can help me edit my scripts, and help me to put everything in order so that I can be sure my calls and functions aren't redundant. I'm not asking you to do the work. This started out as a hobby but now it's not fun any more :(

Please email me at pineatree@hotmail.com

Thanks.
0
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 

Author Comment

by:celere
ID: 7178926
This question should have been deleted as it was accidentally duplicated by EE - not me. But since it remains open, the solution was this:

the standard doesn't allow to use space you should replace them with "+" sign

as posted in the original question, which should not have been duplicated.
0
 

Author Comment

by:celere
ID: 7178929
This question should have been deleted as it was accidentally duplicated by EE - not me. But since it remains open, the solution was this:

the standard doesn't allow to use space you should replace them with "+" sign

as posted in the original question, which should not have been duplicated.
0
 

Author Comment

by:celere
ID: 7178931
This question should have been deleted as EE DUPLICATED it when I went to EDIT it. But here are the points. The solution was this:

the standard doesn't allow to use space you should replace them with "+" sign

Thanks Again.
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Connecting to linux server using Net::Telnet module 25 232
Perl output collect 7 67
Perl string replace for refred url 9 62
Perl Awk Need Help 3 116
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…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

786 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