in reply to Why does CGI::query_string make semicolons the rule, not the exception?

Update: Sorry.. Realized you weren't asking how to change the URL style emitted by query_string... You probably know how to do that. I'm not sure which browsers do support the semicolon style, and I can't remember ever seeing a site use it (probably due to your claim about MSIE not liking it). Anyway, nothing to see here folks..

...

Check the docs! You can specify your preference like this: use CGI qw/param -oldstyle_urls/;

-newstyle_urls
Separate the name=value pairs in CGI parameter query strings with semicolons rather than ampersands. For example:

?name=fred;age=24;favorite_color=3

Semicolon-delimited query strings are always accepted, but will not be emitted by self_url() and query_string() unless the -newstyle_urls pragma is specified.

This became the default in version 2.64.

-oldstyle_urls
Separate the name=value pairs in CGI parameter query strings with ampersands rather than semicolons. This is no longer the default.

blokhead

Replies are listed 'Best First'.
Re: Re: Why does CGI::query_string make semicolons the rule, not the exception?
by hardburn (Abbot) on Apr 13, 2004 at 14:52 UTC

    I can't remember ever seeing a site use it

    Any site using XHTML and passes GET parameters in links has to use that form (assuming they want their XHTML to pass validation). Strict XHTML thinks '&' is always the start of an escape (like ' '), so your choices are to either seperate with semi-colons or to use '&' instead. Laziness dictates which one is used.

    ----
    : () { :|:& };:

    Note: All code is untested, unless otherwise stated