Re: XHTML strict validation & is not allowed in a URL

2007-02-27 Thread Luis Rodrigo Gallardo Cruz
On Tue, Feb 27, 2007 at 03:48:27PM -0600, Barry Books wrote:
> I'm not really proposing this gets fixed and it seems a bit odd to me
> that the spec prohibits '&' in a url considering everyone seems to use
> them there, but it might be nice if future versions used something
> other than '&' or allow you to configure it.

It's not that the spec prohibits &. I't just that it prohibits
*unescaped* & in XML (thus in XHTML) documents. Just as it prohibits
unescaped < and >. Thus, AFAIK, 'all' that's needed is for methods
that write attribute values to replace & by & when writing. Note
that this is not URL quoting, as when replacing ' ' with +. This is an
extra layer of quoting that's supposed to be applied to *anything* that
gets written to XML, including URLs.

-- 
Rodrigo Gallardo
GPG-Fingerprint: 7C81 E60C 442E 8FBC D975  2F49 0199 8318 ADC9 BC28
Zenophobia: the irrational fear of convergent sequences.


signature.asc
Description: Digital signature


Re: XHTML strict validation & is not allowed in a URL

2007-02-27 Thread Barry Books

I read the spec 4 or 5 times before I believed it. It seems a bit odd
to invalidate every web page on the planet in the name of progress.
Then to add insult to injury the validator produces about 5 errors for
each one of these.

Barry

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: XHTML strict validation & is not allowed in a URL

2007-02-27 Thread Jesse Kuhnert

It still seems to me like the only "problem" here is the w3c validator
itself. Looking at any web browser available it seems quite obvious
that it is just plain wrong. ;)

(not to say that ultimately finding a way to make it be quiet isn't
worth it, there are just too many actual problems sitting in jira to
fix first )

On 2/27/07, Barry Books <[EMAIL PROTECTED]> wrote:

I guess it depends on what you mean by friendly urls. It would easy to
fix the page service but in looking thru the code it appears the
direct service separates it's parameters with an '&' also. While it's
possible to replace all that code it's quit a bit of work considering
the problems appears to be the '&' in the code below. I'm guessing
there is another one one the decode side.

I'm not really proposing this gets fixed and it seems a bit odd to me
that the spec prohibits '&' in a url considering everyone seems to use
them there, but it might be nice if future versions used something
other than '&' or allow you to configure it.

package org.apache.tapestry.engine.EngineServiceLink

private void addParameters(StringBuffer buffer)
{
String[] names = getParameterNames();

String sep = "?";

for (int i = 0; i < names.length; i++)
{
String name = names[i];
String[] values = getParameterValues(name);

if (values == null)
continue;

for (int j = 0; j < values.length; j++)
{
buffer.append(sep);
buffer.append(name);
buffer.append("=");
buffer.append(encode(values[j]));

sep = "&";
}

}
}

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





--
Jesse Kuhnert
Tapestry/Dojo team member/developer

Open source based consulting work centered around
dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: XHTML strict validation & is not allowed in a URL

2007-02-27 Thread Barry Books

I guess it depends on what you mean by friendly urls. It would easy to
fix the page service but in looking thru the code it appears the
direct service separates it's parameters with an '&' also. While it's
possible to replace all that code it's quit a bit of work considering
the problems appears to be the '&' in the code below. I'm guessing
there is another one one the decode side.

I'm not really proposing this gets fixed and it seems a bit odd to me
that the spec prohibits '&' in a url considering everyone seems to use
them there, but it might be nice if future versions used something
other than '&' or allow you to configure it.

package org.apache.tapestry.engine.EngineServiceLink

private void addParameters(StringBuffer buffer)
   {
   String[] names = getParameterNames();

   String sep = "?";

   for (int i = 0; i < names.length; i++)
   {
   String name = names[i];
   String[] values = getParameterValues(name);

   if (values == null)
   continue;

   for (int j = 0; j < values.length; j++)
   {
   buffer.append(sep);
   buffer.append(name);
   buffer.append("=");
   buffer.append(encode(values[j]));

   sep = "&";
   }

   }
   }

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: XHTML strict validation & is not allowed in a URL

2007-02-27 Thread Andreas Andreou

Looks related to
http://issues.apache.org/jira/browse/TAPESTRY-1218

Try enabling friendly urls... it should fix this for now

On 2/27/07, Barry Books <[EMAIL PROTECTED]> wrote:


I started validating my site as XHTML strict and ran into a problem Idid
not expect. The W3C validator reports
# Warning  Line 9 column 109: cannot generate system identifier forgeneral
entity "service".
...Acumera/app?page=AcuVigil%3AMGStatus&service=page"/>
With the following explanation:
http://www.htmlhelp.com/tools/validator/problems.html#amp
Ampersands (&'s) in URLs
Another common error occurs when including a URL which contains
anampersand ("&"):
 ...
This example generates an error for "unknown entity section" becausethe
"&" is assumed to begin an entity reference. Browsers oftenrecover safely
from this kind of error, but real problems do occur insome cases. In this
example, many browsers correctly convert ©=3to (c)=3, which may cause
the link to fail. Since ⟨ is the HTMLentity for the left-pointing angle
bracket, some browsers also convert&lang=en to 〈=en. And one old browser
even finds the entity §,converting §ion=2 to §ion=2.
To avoid problems with both validators and browsers, always use &in
place of & when writing URLs in HTML:
...
Note that replacing & with & is only done when writing the URL inHTML,
where "&" is a special character (along with "<" and ">"). Whenwriting the
same URL in a plain text email message or in the locationbar of your
browser, you would use "&" and not "&". With HTML, thebrowser translates
"&" to "&" so the Web server would only see "&"and not "&" in the
query string of the request.

This surprised me because every url I've ever seen has an & in it.Doesthis seem 
correct and if so I guess Tapestry should support aseparator other
than &
Barry





--
Andreas Andreou - [EMAIL PROTECTED] - http://andyhot.di.uoa.gr
Tapestry / Tacos developer
Open Source / JEE Consulting


XHTML strict validation & is not allowed in a URL

2007-02-27 Thread Barry Books

I started validating my site as XHTML strict and ran into a problem I
did not expect. The W3C validator reports

# Warning  Line 9 column 109: cannot generate system identifier for
general entity "service".

...Acumera/app?page=AcuVigil%3AMGStatus&service=page"/>

With the following explanation:

http://www.htmlhelp.com/tools/validator/problems.html#amp

Ampersands (&'s) in URLs

Another common error occurs when including a URL which contains an
ampersand ("&"):

 ...

This example generates an error for "unknown entity section" because
the "&" is assumed to begin an entity reference. Browsers often
recover safely from this kind of error, but real problems do occur in
some cases. In this example, many browsers correctly convert ©=3
to (c)=3, which may cause the link to fail. Since ⟨ is the HTML
entity for the left-pointing angle bracket, some browsers also convert
&lang=en to 〈=en. And one old browser even finds the entity §,
converting §ion=2 to §ion=2.

To avoid problems with both validators and browsers, always use &
in place of & when writing URLs in HTML:

...

Note that replacing & with & is only done when writing the URL in
HTML, where "&" is a special character (along with "<" and ">"). When
writing the same URL in a plain text email message or in the location
bar of your browser, you would use "&" and not "&". With HTML, the
browser translates "&" to "&" so the Web server would only see "&"
and not "&" in the query string of the request.


This surprised me because every url I've ever seen has an & in it.
Does this seem correct and if so I guess Tapestry should support a
separator other than &

Barry