Link to home
Start Free TrialLog in
Avatar of celere
celere

asked on

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

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.

ASKER CERTIFIED SOLUTION
Avatar of Tsvetomir
Tsvetomir

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
Avatar of BigJoe1008
BigJoe1008

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
Avatar of celere

ASKER

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.
Avatar of celere

ASKER

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.
Avatar of celere

ASKER

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.
Avatar of celere

ASKER

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.