Forum Moderators: open

Message Too Old, No Replies

Use of '&' character

         

gulliver

9:48 pm on Feb 19, 2004 (gmt 0)

10+ Year Member



Are there problems in using the '&' character for site directories and image names?

Directory example...

domain.com/see&do/

Image example...

/graphics/nav/topbar/see&do/see&do.gif

Common sense suggests I should avoid them and rename stuff accordingly - particularly as Dreamweaver renames the '&' to the '&' entity.

txbakers

9:51 pm on Feb 19, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yes, becuase the '&' is used as a concatenator for query strings in dynamic pages.

Best not to use that in a directory name.

gulliver

10:17 pm on Feb 19, 2004 (gmt 0)

10+ Year Member



Thanks. Appreciated. I'll find a workaround.

Out of interest, if the site is entirely static/hard-coded pages, will it cause any problems?

txbakers

10:33 pm on Feb 19, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



probably not.

tombola

10:36 pm on Feb 19, 2004 (gmt 0)

10+ Year Member



the '&' is used as a concatenator for query strings in dynamic pages

... when there is a question mark in the url string.

For example: [example.com...]

A few years ago, I had set up a subdomain with the "&" character for one of my clients. That subdomain was pointing to a directory with the same name on my server.

Subdomain: [j&d.example.com...]
Directory: [example.com...]

There were NO problems at all.

WeirdoPL

10:59 pm on Feb 19, 2004 (gmt 0)

10+ Year Member



So tombola...
Would it validate correctly [as a link for example]?
Would it make any diffrence if instead of
[t&d.domain.any...]
I'd put:
[t&d.doamin.any...]
?

Purple Martin

2:05 am on Feb 20, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



& is best for validation.

g1smd

9:14 pm on Feb 23, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



nay....... it is required.

gulliver

9:46 pm on Feb 23, 2004 (gmt 0)

10+ Year Member



I had some varied results on the w3 validator.

Sometimes it accepted the & when not in an url. Sometimes it rejected it.

vkaryl

2:50 am on Feb 24, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I had some varied results on the w3 validator.
Sometimes it accepted the & when not in an url. Sometimes it rejected it.

I had just the "plain" result with w3c's validator (in both html 4.01 transitional AND strict): any instance of "&" anywhere on the page in question occasioned an error notation. Use of "&" fixed all the errors.

grahamstewart

9:03 am on Feb 24, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



W3C says:

When to use escapes

There are three characters which should always appear in content as escapes, so that they do not interact with the syntax of the markup:

  • &lt; (<)

  • &gt; (>)

  • &amp; (&)

    You may also want to represent the double-quote (") as &quot;


  • - from [w3.org...]

    tombola

    9:30 am on Feb 24, 2004 (gmt 0)

    10+ Year Member



    The original poster asked in msg#1:

    Are there problems in using the '&' character for site directories and image names?

    The answer is NO.
    It has nothing to do with CONTENT but with the FILENAME of a page/directory/image.

    I have just set up a directory "te&st" and it validates as XHTML1.1.

    Sometimes the best way to find out if things works, is just doing it.

    grahamstewart

    9:48 am on Feb 24, 2004 (gmt 0)

    WebmasterWorld Senior Member 10+ Year Member



    But as WeirdoPL pointed out in msg #6, anyone linking to the site would have to remember to escape the ampersand correctly.

    This could mean that less skilled users link to your site incorrectly so you could miss out on useful PR boosts.

    It just doesn't seem worth the bother.