Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / Best way to escape characters in URL?

Best way to escape characters in URL?

Locked

Views: 2,052

Results 1 to 4 of 4
This thread is locked. New replies are disabled.
28 Oct 2007, 9:55 PM
#1
creativearc avatar

creativearc

New Zenner

Join Date:
Feb 2007
Posts:
65
Plugin Contributions:
0

Best way to escape characters in URL?

The & (ampersand) character, for one, is enough to invalidate a stock ZenCart site.

I looked at some old threads and didn't find exactly what I was looking for in an effort to validate all of my URLs. One article did reference the /includes/functions/html_output.php file.

At line 57, I changed the line from this:

$separator = '&';

To this:

$separator = '&';

Which seems to solve the problem.

Can any of the proficient PHP programmers out there confirm if this is the best location to make this modification? Am I just lucky that it helped my particular case, or is there a chance URLs might invalidate with other characters that are not escaped?

29 Oct 2007, 6:58 AM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: Best way to escape characters in URL?

You'll notice that line 94 already does that for you:

    $link = ereg_replace('&', '&', $link);
30 Oct 2007, 1:41 PM
#3
creativearc avatar

creativearc

New Zenner

Join Date:
Feb 2007
Posts:
65
Plugin Contributions:
0

Re: Best way to escape characters in URL?

If that's the case, why were all of my ampersands unescaped? That is, & instead of & ?

30 Oct 2007, 2:35 PM
#4
Kim avatar

Kim

Obaa-san

Join Date:
Jun 2003
Location:
West Coast, North America
Posts:
26,606
Plugin Contributions:
0

Re: Best way to escape characters in URL?

All of the links or only certain links? The URL?