Go Back   Trackpads Community > General Discussions > Computer and Technology > Web Design

Web Design Forums and discussions on webdesign

Web Design

Reply
 
LinkBack Thread Tools
Old 12-26-2004, 13:00   #1 (permalink)
nospam@geniegate.com
Civilians

 
Default XHTML and the & in url's.

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 &amp; 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
 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Trackpads Information
Click to Visit
Old 12-26-2004, 13:00   #2 (permalink)
Tommy Gildseth
Civilians

 
Default Re: XHTML and the & in url's.

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 &amp; 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 &amp; in your URLs in the HTML documents break
anything? The browser won't actually send &amp;, it will send just &.


--
Tommy

 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 12-26-2004, 16:00   #3 (permalink)
Oli Filth
Civilians

 
Default Re: XHTML and the & in url's.

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.
&amp 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 &amp; 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 &amp; in your URLs in the HTML documents break
> anything? The browser won't actually send &amp;, it will send just &.
>
>

 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 12-26-2004, 16:00   #4 (permalink)
SpaceGirl
Civilians

 
Default Re: XHTML and the & in url's.

nospam@geniegate.com wrote:
> I've been trying to convert my habits over to XHTML.
>
> One stumbling block, does one have to use &amp; 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 &amp; 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&amp;name=jerry">foo</a>

--


x theSpaceGirl (miranda)

# lead designer @ http://www.dhnewmedia.com #
# remove NO SPAM to email, or use form on website #
 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 12-26-2004, 16:00   #5 (permalink)
Oli Filth
Civilians

 
Default Re: XHTML and the & in url's.

According to the W3C specs on XHTML, if you want an ampersand literal
within an XHTML document, you should always use its entity reference &amp;

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 &amp; 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 &amp; in your URLs in the HTML documents break
> anything? The browser won't actually send &amp;, it will send just &.
>
>

 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 12-26-2004, 19:00   #6 (permalink)
Cameron
Civilians

 
Default Re: XHTML and the & in url's.

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 &amp; 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 &amp; in your URLs in the HTML documents break
> anything? The browser won't actually send &amp;, 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 &amp;.

~Cameron
 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 12-26-2004, 22:00   #7 (permalink)
Norman L. DeForest
Civilians

 
Default Re: XHTML and the & in url's.


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 &amp; 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 &amp; 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&amp;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 '&amp;' 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&amp;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 "&num;"
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

 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

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


Community Information
Options
Quick Options
Trackpads Non-Commercial Ad
Copyright Information Click to Visit
Time
Server Time
All times are GMT -4. The time now is 09:56.
Copyright
Copyright Information
The header is based off of work by Vipixel.com and modified by this site. Trackpads and the Trackpads Logo are both Registered Trademarks of Jason Edwards and cannot be used without prior written permission.  The only exception is as a link back to this site. Trackpads is a private website run by a small legion of volunteers, 3 dogs, 12.5 cats and an army of small, super smart, bio-engineered mice with pointy hats and tutu's. Search Engine Friendly URLs by vBSEO 3.2.0 RC7
Archive Links
Archive Links
Page generated in 1.41874 seconds with 19 queries