[Zope] Any alternative to &arg in URL?

Duncan Booth duncan@rcp.co.uk
Thu, 30 Sep 1999 12:23:38 +0000


> I am working on a site using both POST and GET
> forms and I use URL args frequently in the target:
> 
> action="subfolder/index_html?arg1=spam&arg2=eggs&..." 
> 
> Using the '&' character in URLs is not legal HTML
> (4.0-strict). Does Zope recognize other arg
> separators besides '&'?  I don't want to give up
> the way Zope parses and places the args into the
> namespace for me.
> 
You can replace the '&' where it occurs in the arguments with %26 
and it will be turned back into '&' when the url is processed.

If you are building up the URL in DTML, then use the url_quote 
option on any expressions to escape all the illegal characters (or 
use the &dtml-xxx; syntax which escapes the &, but doesn't 
necessarily escape all the other bad characters.).

For example:

<dtml-let spam="'A nasty ?&:/\\ string\n'">
action="subfolder/index_html?arg1=&dtml-spam;&arg2=<dtml-var 
spam url_quote>&..." 
</dtml-let>

produces:

action="subfolder/index_html?arg1=A nasty ?&amp;:/\ string
&arg2=A%20nasty%20%3f%26%3a/%5c%20string%0a&..."


-- 
Duncan Booth                                             duncan@dales.rmplc.co.uk
int month(char *p){return(124864/((p[0]+p[1]-p[2]&0x1f)+1)%12)["\5\x8\3"
"\6\7\xb\1\x9\xa\2\0\4"];} // Who said my code was obscure?
http://dales.rmplc.co.uk/Duncan