Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Removing or replacing space character

Status
Not open for further replies.

tango55

Technical User
Oct 9, 2007
1
FR
This is my first delve into Perl or any kind of programming. I have just started using slimbox to show photos on my site. Basically any photo with a % in the name like this "maran%2525252520parc%2525252520web.jpg"
doesn't work. i am assuming this is a space character from when my user uploaded a photo with a space in the name.

Code on my html page for showing this is: <%if Image2%><A HREF="<%Image2_largest_path%>" rel="lightbox"><IMG SRC="<%Image2_medium_path%>" BORDER="0"></A><%endif%>

I'd be grateful for any suggestions on how to deal with this (replacing it? removing it?) or even just a nudge in the right direction. I have spent a week looking on help pages but it is just a bit beyond me. :(

Andy
 
Code:
use URI::Escape;
my $uri = "hello%20world%25";
$uri = uri_unescape ($uri);
print $uri, "\n";

By the way, a % isn't always a space, % is only a space if its followed by a 20. In URL encoding, % is used to escape every special character (besides some simple ones like -, &, =, and .)

-------------
Cuvou.com | My personal homepage
Project Fearless | My web blog
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top