Problem with urlencode
3 posts by 2 authors in: Forums > CMS Builder
Last Post: August 14, 2008 (RSS)
By johnniefp - August 14, 2008
Hello.
I'm building a menu from a text file which will also be used for a search, the problem I'm having is encoding the string to use as a querystring for the search
example string to encode:
If I use the urlencoder on your search docs page (http://www.interactivetools.com/docs/cmsbuilder/viewer_search.html) it encodes it like this:
If I use php's build in urlencode I get this:
I'd prefer to use php to do this as all I need to update is a text file rather than manaully editing going via the search docs page
thanks.
Can anyone help with this issue?
I'm building a menu from a text file which will also be used for a search, the problem I'm having is encoding the string to use as a querystring for the search
example string to encode:
Chemicals & Dispensers
If I use the urlencoder on your search docs page (http://www.interactivetools.com/docs/cmsbuilder/viewer_search.html) it encodes it like this:
Chemicals%20%26%20Dispensers
If I use php's build in urlencode I get this:
Chemicals+%26amp%3B+Dispensers%0A
I'd prefer to use php to do this as all I need to update is a text file rather than manaully editing going via the search docs page
thanks.
Can anyone help with this issue?
Re: [johnniefp] Problem with urlencode
By johnniefp - August 14, 2008
Problem solved.
The %0A is an encoded newline character:
removed on unix with: (from memory you probably need \n\r on windows and \r on mac)
I ended up just using & instead of & which solved the next problem.
Also where the urlencode on the search docs page shows %20 (spaces) I have found that + (output from php urlencode() function) also works with the search.
The %0A is an encoded newline character:
removed on unix with: (from memory you probably need \n\r on windows and \r on mac)
$cat = str_replace("\n","",$cat);
I ended up just using & instead of & which solved the next problem.
Also where the urlencode on the search docs page shows %20 (spaces) I have found that + (output from php urlencode() function) also works with the search.
Re: [johnniefp] Problem with urlencode
By Donna - August 14, 2008
Hey, glad to hear you've got that sorted out. Let us know if you run into any problems!
Donna
--
support@interactivetools.com
--
support@interactivetools.com