Freepages-Help-L Archives

Archiver > Freepages-Help > 2006-05 > 1148842759


From: Rod Dav4is <>
Subject: Re: [FreeHelp] uploading help needed
Date: Sun, 28 May 2006 14:59:19 -0400
References: <000e01c68114$1bed3fa0$2a2a443d@Barbara><7.0.1.0.0.20060527100957.019ecc80@ee.net> <4478A4BE.2000908@VERIZON.NET><7.0.1.0.0.20060527152315.01b36f20@ee.net> <4478BA2D.6000902@VERIZON.NET><4478BDEB.6020303@VERIZON.NET> <7.0.1.0.0.20060528110924.019dec28@ee.net>
In-Reply-To: <7.0.1.0.0.20060528110924.019dec28@ee.net>


Nobody said that it was easy, but let's get it right!

Pat Asher wrote:

> Rod:
>
> A link written to
>
> <.a
> href="http://freepages.genealogy.rootsweb.com/~dav4is/test/nonce/A&B.txt">;
>
>
> will not validate.

Of course it won't validate, but it has NOTHING TO DO with it being
in a URL! It doesn't validate because ampersand is a reserved character
in ALL of a HTML document, i.e. anywhere: URLs, Headings, Titles, open
text, anywhere. To use an ampersand in an HTML document, you /must/ use
the character entity &amp;. In the context of HTML, ampersands are used
/only/ for character entities.

> If it doesn't validate, some browsers may return the dreaded 404 File
> not found error -- which makes it invalid in my book <g>

1. 404 is one of many HTTP User Agent error codes. Here
<http://en.wikipedia.org/wiki/List_of_HTTP_status_codes>; is a
complete list.
2. In point of fact, servers don't understand the character entities,
such as &amp;. When your browser is preparing a URL for
transmission to a server, perhaps to fetch a page, it first has to
change certain special characters that are not valid in URLs in
the context of the network (nothing to do with HTML). One of these
is ampersand, so wherever it sees an an ampersand or the
equivalent character entity &amp;, it changes these to the ASCII
escape code %26.

>
> Not all webmasters at Freepages are familiar with ASCII character
> codes (i.e. "&amp" to replace "&").

1. Terminology: &amp; is a /character entity/, which is an HTML term.
ASCII has nothing to do with it.
2. The ending semicolon IS required. I.e. "&amp" is nothing, "&amp;"
is a character entity.

> And visitors to their sites are even less likely to know they can
> right click to view source

Not all browsers have a "view source" option. OffByOne, for example,
does not.

> , copy the problem URL, paste it in the address box of their browser,
> and change the ampersand to the ASCII character code before hitting
> Go/Enter.

Changing the address to the ASCII code (i.e. "&" to "%26") would be
OK, but changing to a character entity (i.e. "&" to "&amp;") will be
sure (at least in every browser I've tried) to get the "dreaded 404".
This should make it clear that ASCII codes are not the same things as
character entities, and each has its proper usage.

>
> Special characters *are* reserved for

Terminology: Define "reserved for".

> scripts (executables) and can cause unintended consequences when used
> in file names on the web. I remember one named
>
> Is this "Nanny" & George?.jpg

This /is/ a valid filename on UNIX based processors, as are the RootsWeb
servers, but /not/ on Windows, e.g. most PCs and some servers. IAC, your
browser will change the double quotes to the ASCII code %22. The trick
is how to code the link in HTML. You can't just do it like this:

< A href="Is this "Nanny" & George?.jpg">...

You see the problem with the quotes? Would you say that double quotes
are "reserved" in URLs? In the href attribute? Not at all. Double quotes
/are/ prohibited (reserved?) in strings that are set off with double
quotes, in /any/ HTML markup, href or otherwise. The solution is simple:
use single quotes for the href attribute:

< A href='Is this "Nanny" & George?.jpg'>...

Your browser will make the necessary adjustments. Of course the
ampersand may be a problem, but we already know how to fix that, right?
RIGHT?

Nobody said that it was easy. ;o)

--
Regards, Rod Dav4is / P.O. Box 118 / Hyde Park, NY 12538 / USA
Genealogy, et Cetera: http://freepages.rootsweb.com/~dav4is/
439 ancestral & collateral families, mostly 17°-19° century
New England & European roots. Total population: 106,200+
Annex: http://www.gencircles.com/users/dav4is/
email:
"The sooner you fall behind, the more time you'll have to catch up."
-Steven Wright



This thread: