Gossamer Forum
Home : Products : Gossamer Links : Discussions :

help/experience with url_escape with Title

Quote Reply
help/experience with url_escape with Title
Hi,

I want to use rewrite rules to build nice urls for the detailed pages.
Now it seems there is a problem with some characters.
At the moment I made a small sub with the following lines:

Code:
sub {
my $return = $_[0];
$return =~ s/\s|\/|;|"|&/-/g;
$return = GT::CGI::escape($return);
$return =~ s/-{1,}/-/g;
return $return;
}

Thank you for any feedback.

Regards

Niko
Quote Reply
Re: [el noe] help/experience with url_escape with Title In reply to
Are you asking if thats an ok way to do it? If so, looks fine to me.

Cheers

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] help/experience with url_escape with Title In reply to
Hi Andy,

thank you for your reply. "ok way" sounds good.
The thread was meant as: does anyone see a problem.
I had a regexp with all sorts of characters like รค => ae and switched to the above method. The first error occured with / (the url was interpreted as a category), then I stepped over " and & .
I was thinking if there might be other characters which could lead to a invalid url.

Regards

Niko
Quote Reply
Re: [el noe] help/experience with url_escape with Title In reply to
Hi,

Apart from ' , I can't think of any more from the top of my head.

Cheers

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] help/experience with url_escape with Title In reply to
Hi Andy,

you are right, I am going to add ' as well.

Thanks

Niko