Gossamer Forum
Home : Products : Others : Gossamer Community :

Can unescape :/

Quote Reply
Can unescape :/
Hi,

I'm trying to convert a URL, like this;

http%3A%2F%2Fwww.domain.com%2FEconomics%2FA_monopoly_can_control_price_or_output_but_not_both_L1624%2F

I'm using this global;

Code:
sub {
my $in = $_[0];
return unless defined $in;
for my $str (ref $in eq 'ARRAY' ? @$in : $in) {
$str =~ tr/+/ /; # pluses become spaces
$str =~ s/%([0-9a-fA-F]{2})/chr(hex($1))/ge;
}

print "FOO: $in";
return \$in;
}

Can anyone see whats going wrong? Even when passing it via this global, it doesn't "convert" it into a valid URL (i.e http://www.domain.com/....).

I've made sure that its being escaped (with \$in) .. but that doesn't seem to be having any affect :/

TIA

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Can unescape :/ In reply to
Oh, BTW.. I've also tried;

<%GT::CGI::unescape($url)%>

..which has exactly the same result :(

TIA

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Can unescape :/ In reply to
Hmmm ... strange
This works for me Crazy

Quote:
<%GT::CGI::unescape('http%3A%2F%2Fwww.domain.com%2FEconomics%2FA_monopoly...etc')%>

the result is printed as follow:

http://www.domain.com/Economics/A_monopoly_can_control_price_or_output_but_not_both_L1624/

May be won't work for another reason on your site?
Or some double escape somewhere?

Cheers,
Boris

Facebook, Twitter and Google+ Auth for GLinks and GCommunity | reCAPTCHA for GLinks | Free GLinks Plugins
Quote Reply
Re: [eupos] Can unescape :/ In reply to
Thanks for the reply.

Yes, its very odd Unsure


Code:
<br/><%GT::CGI::unescape('http%3A%2F%2Fwww.domain.com%2FEconomics%2FA_monopoly...etc')%>
<br/><%GT::CGI::unescape($url)%>
<br/><%url%>

.. gives this;

http://www.domain.com/Economics/A_monopoly...etc
http%3A%2F%2Fwww.domain.com%2FAccounting%2FThe_Relationship_between_The_Nominal_Interest_Rate_On_Bonds_and_L1143%2F
http%253A%252F%252Fwww.domain.com%252FAccounting%252FThe_Relationship_between_The_Nominal_Interest_Rate_On_Bonds_and_L1143%252F


Pirate

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [eupos] Can unescape :/ In reply to
Wow.. very weird :/

I managed to get it working, with this;

Code:
sub {
my $in = $_[0];
$in = GT::CGI::unescape($in);
$in = GT::CGI::unescape($in);
return \$in;
}

Very odd Crazy

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Can unescape :/ In reply to
Looks like somewhere the $url is double escaped Crazy

Cheers,
Boris

Facebook, Twitter and Google+ Auth for GLinks and GCommunity | reCAPTCHA for GLinks | Free GLinks Plugins