urls and apostrophe

21 views
Skip to first unread message

album author - David Ljung Madison

unread,
Mar 7, 2010, 11:05:23 PM3/7/10
to album-users, alan+...@clifford.ac

Going through my old email, I realized I had never replied to this
message from Alan.

I can't reopen the discussion in Google Groups, so I'm posting a new
discussion to answer it:


> $gpscaption = Get(This_Image,"cap") ;
> $gpsurl='<a href=\'http://maps.google.co.uk/?q='.$psposition.'
> ('.$gpscaption.') &z=13 &t=h &output=embed\'>geotag</a>' ;
>
>
> which has produced
>
> <a href='http://maps.google.co.uk/?q=13.2675037333011 -59.5940297600167
> (A caption's apostrophe) &z=13 &t=h &output=embed'>geotag</a>

I don't know if you've solved this yet, but couldn't you just do:

$gpscaption = Get(This_Image,"cap") ;
$gpscaption =~ s/'/&#39/g;

That should solve the problem for you.

Alan Clifford

unread,
Mar 8, 2010, 3:28:25 PM3/8/10
to album-users

Thanks for the response. What I used was:

$gpscaption = Get(This_Image,"cap") ;

@badustuff = qw(< > & ' ") ;
@goodustuff = ("%3C", "%3E", "%26", "%27", "%22") ;
for (my $uctr = 0 ; $uctr <= $#badustuff ; $uctr++)
{
$gpscaption =~ s/$badustuff[$uctr]/$goodustuff[$uctr]/g ;
}

I suspect that that is not the way to do it in Perl though.

I seem to remember that it needed the % syntax rather than the &# syntax
as that is what google maps required.

Alan

Reply all
Reply to author
Forward
0 new messages