![]() | ![]() | ![]() |
| |||||||
| Forums | Register | Groups | Awards | Arcade | Pets | T-Bucks / T-Store | Invite Your Friends | Blogs | Mark Forums Read |
| Web Design Forums and discussions on webdesign |
Web Design | |||||||||
|
|
|
|
| |||||
![]() |
| | LinkBack | Thread Tools |
| | #1 (permalink) |
| Civilians | I've been trying to convert my habits over to XHTML. One stumbling block, does one have to use & in URL's to separate form variables? <a href="foo.cgi?q=1&name=jerry">foo</a> Of course, &name is choked on, because it's an entity reference w/out a semicolon. One thing I've seen CGI.pm (from the perl world) do is accept semi-colons: <a href="foo.cgi?q=1;name=jerry">foo</a> This makes more sense to me, but is it an actual standard? if so, how would I get PHP to use it instead of &? (without any editing of PHP's .ini files) Going through and changing & to & in my URL's would probably break lots of things and be harder to maintain. Short of parsing the query string myself, there doesn't seem to be a lot of alternatives. Ideas? Any other solutions? Jamie -- http://www.geniegate.com Custom web programming guhzo_42@lnubb.pbz (rot13) User Management Solutions |
|
| | #2 (permalink) |
| Civilians | nospam@geniegate.com wrote: > I've been trying to convert my habits over to XHTML. > > Of course, &name is choked on, because it's an entity reference w/out > a semicolon. > > One thing I've seen CGI.pm (from the perl world) do is accept semi-colons: > > <a href="foo.cgi?q=1;name=jerry">foo</a> > > This makes more sense to me, but is it an actual standard? if so, how > would I get PHP to use it instead of &? (without any editing of PHP's .ini > files) Have a look at the arg_separator.input config directive > > Going through and changing & to & in my URL's would probably break > lots of things and be harder to maintain. Short of parsing the query > string myself, there doesn't seem to be a lot of alternatives. Why would changing & to & in your URLs in the HTML documents break anything? The browser won't actually send &, it will send just &. -- Tommy |
|
| | #3 (permalink) |
| Civilians | According to the XHTML specs, you should never use an ampsersand as a literal, you should always convert it to an entity reference (i.e. & when using it in XHTML documents.See http://www.w3.org/TR/xhtml1/#C_12. Oli Tommy Gildseth wrote: > nospam@geniegate.com wrote: > > >>I've been trying to convert my habits over to XHTML. >> >>Of course, &name is choked on, because it's an entity reference w/out >>a semicolon. >> >>One thing I've seen CGI.pm (from the perl world) do is accept semi-colons: >> >><a href="foo.cgi?q=1;name=jerry">foo</a> >> >>This makes more sense to me, but is it an actual standard? if so, how >>would I get PHP to use it instead of &? (without any editing of PHP's .ini >>files) > > > Have a look at the arg_separator.input config directive > > >>Going through and changing & to & in my URL's would probably break >>lots of things and be harder to maintain. Short of parsing the query >>string myself, there doesn't seem to be a lot of alternatives. > > > Why would changing & to & in your URLs in the HTML documents break > anything? The browser won't actually send &, it will send just &. > > |
|
| | #4 (permalink) |
| Civilians | nospam@geniegate.com wrote: > I've been trying to convert my habits over to XHTML. > > One stumbling block, does one have to use & in URL's to separate > form variables? <a href="foo.cgi?q=1&name=jerry">foo</a> > > Of course, &name is choked on, because it's an entity reference w/out > a semicolon. > > One thing I've seen CGI.pm (from the perl world) do is accept semi-colons: > > <a href="foo.cgi?q=1;name=jerry">foo</a> > > This makes more sense to me, but is it an actual standard? if so, how would > I get PHP to use it instead of &? (without any editing of PHP's .ini files) > > Going through and changing & to & in my URL's would probably break lots > of things and be harder to maintain. Short of parsing the query string myself, > there doesn't seem to be a lot of alternatives. > > Ideas? Any other solutions? > > Jamie > <a href="foo.cgi?q=1&name=jerry">foo</a> -- x theSpaceGirl (miranda) # lead designer @ http://www.dhnewmedia.com # # remove NO SPAM to email, or use form on website # |
|
| | #5 (permalink) |
| Civilians | According to the W3C specs on XHTML, if you want an ampersand literal within an XHTML document, you should always use its entity reference & See http://www.w3.org/TR/xhtml1/#C_12. Oli Tommy Gildseth wrote: > nospam@geniegate.com wrote: > > >>I've been trying to convert my habits over to XHTML. >> >>Of course, &name is choked on, because it's an entity reference w/out >>a semicolon. >> >>One thing I've seen CGI.pm (from the perl world) do is accept semi-colons: >> >><a href="foo.cgi?q=1;name=jerry">foo</a> >> >>This makes more sense to me, but is it an actual standard? if so, how >>would I get PHP to use it instead of &? (without any editing of PHP's .ini >>files) > > > Have a look at the arg_separator.input config directive > > >>Going through and changing & to & in my URL's would probably break >>lots of things and be harder to maintain. Short of parsing the query >>string myself, there doesn't seem to be a lot of alternatives. > > > Why would changing & to & in your URLs in the HTML documents break > anything? The browser won't actually send &, it will send just &. > > |
|
| | #6 (permalink) |
| Civilians | Tommy Gildseth wrote: > nospam@geniegate.com wrote: > > >>I've been trying to convert my habits over to XHTML. >> >>Of course, &name is choked on, because it's an entity reference w/out >>a semicolon. >> >>One thing I've seen CGI.pm (from the perl world) do is accept semi-colons: >> >><a href="foo.cgi?q=1;name=jerry">foo</a> >> >>This makes more sense to me, but is it an actual standard? if so, how >>would I get PHP to use it instead of &? (without any editing of PHP's .ini >>files) > > > Have a look at the arg_separator.input config directive > > >>Going through and changing & to & in my URL's would probably break >>lots of things and be harder to maintain. Short of parsing the query >>string myself, there doesn't seem to be a lot of alternatives. > > > Why would changing & to & in your URLs in the HTML documents break > anything? The browser won't actually send &, it will send just &. > > Putting plain ampersand (&) signs in your anchors is a violation of the W3C (X)HTML specification and pages with them wont validate, if you wish to write valid (X)HTML you must always use &. ~Cameron |
|
| | #7 (permalink) |
| Civilians | On Sun, 26 Dec 2004, SpaceGirl wrote: > nospam@geniegate.com wrote: > > I've been trying to convert my habits over to XHTML. > > > > One stumbling block, does one have to use & in URL's to separate > > form variables? <a href="foo.cgi?q=1&name=jerry">foo</a> > > > > Of course, &name is choked on, because it's an entity reference w/out > > a semicolon. > > > > One thing I've seen CGI.pm (from the perl world) do is accept semi-colons: > > > > <a href="foo.cgi?q=1;name=jerry">foo</a> > > > > This makes more sense to me, but is it an actual standard? if so, how would > > I get PHP to use it instead of &? (without any editing of PHP's .ini files) > > > > Going through and changing & to & in my URL's would probably break lots > > of things and be harder to maintain. Short of parsing the query string myself, > > there doesn't seem to be a lot of alternatives. > > > > Ideas? Any other solutions? > > > > Jamie > > > > > <a href="foo.cgi?q=1&name=jerry">foo</a> Indeed. See RFC 1866 - Hypertext Markup Language - 2.0, section 8.2.1 at one of these locations for more on this: http://www.faqs.org/rfcs/rfc1866.html http://info.internet.isi.edu/in-note...es/rfc1866.txt ftp://ftp.isi.edu/in-notes/rfc1866.txt It not only requires '&' in URLs to be encoded as '&' but recommends the use of ';' instead of '&' as a parameter separator: [snip] : 8.2.1. The form-urlencoded Media Type [snip] : NOTE - The URI from a query form submission can be : used in a normal anchor style hyperlink. : Unfortunately, the use of the `&' character to : separate form fields interacts with its use in SGML : attribute values as an entity reference delimiter. : For example, the URI `http://host/?x=1&y=2' must be ^^^^ : written `<a href="http://host/?x=1&y=2"' or `<a : href="http://host/?x=1&y=2">'. : : HTTP server implementors, and in particular, CGI ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ : implementors are encouraged to support the use of ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ : `;' in place of `&' to save users the trouble of ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ : escaping `&' characters this way. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [snip] A parameter name in a URL that is preceded by an unescaped ampersand can easily be mistaken by a standards-conforming browser as a character entity specification (since the trailing ';' in a character entity if the following character is not a letter or a digit) and completely foul up any attempt to access the desired page. I have already seen problems with: "&image=" (to select an image) being interpreted as (imaginary 'i') + "=", "&lang=" (language) being interpreted as (left angle bracket) + "=",<br> "&prod=" (product -- as in commercial product such as toilet paper) being interpreted as (mathematical product sign -- result of a series of multiplications) + "=", "&bull=" (bulletin) being interpreted as (bullet) + "=", and "&part=" (part -- of a multi-part thread or set of web pages) being interpreted as (mathematical partial differential) + "=". Google uses "&num=" to specify the number of entries to display and lynx (when the optional extended entity set is compiled in) recognises "#" as a non-standard entity for '#' so the "&num=" is interpreted as "#=", preventing lynx users from following the links that use this unless they edit the URL. -- Norman De Forest http://www.chebucto.ns.ca/~af380/Profile.html af380@chebucto.ns.ca [=||=] (A Speech Friendly Site) "O'Reilly is to a system administrator as a shoulder length latex glove is to a veterinarian." -- Peter da Silva in the scary devil monastery |
|
![]() |
| Bookmarks |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Help on HTML and Relative URL's? | Arnie Goetchius | Web Design | 4 | 04-05-2005 12:00 |
| XHTML 1.0 strict vs XHTML 1.1 | Kerberos | Web Design | 2 | 01-17-2005 08:00 |
| Mobile Weather URL's | Beverly Howard [Ms-MVP/MobileDev] | Microsoft Applications | 17 | 07-23-2004 20:41 |
| Mobile Weather URL's | Beverly Howard [Ms-MVP/MobileDev] | Microsoft Applications | 6 | 07-23-2004 19:15 |
![]() | ![]() | ![]() |