• Numeric character references in href tags

    Home » Forums » Developers, developers, developers » Web design and development » Numeric character references in href tags

    Author
    Topic
    #437150

    Can anyone tell me if it’s acceptable or otherwise to use & as an escape character for an ampersand in an href tag.

    The coding standards here “encourage” the use of numeric character references, supposedly because they’re not so English-language dependent, but the link checking software we use doesn’t like them. The software vendors claim that their use is “illegal”, citing the RFC1738 standard (which I’m not sure I fully understand). The software can’t distinguish between a hash character used as part of a fragment identifier and a hash character used as part of a numeric character reference.

    However, online validators provided by W3C and WDG (for example) seem to accept their use. The attached file – designed to be an HTML one – provides examples that can be tested (it has links to the validators).

    Thanks in anticipation of the enlightenment to follow.

    Viewing 1 reply thread
    Author
    Replies
    • #1038391

      That’s an old RFC (1994) and since that time the web has become more multilingual. Perhaps your link checking software needs to be updated??

      Anyway, I think & probably is a global standard…

    • #1045063

      Hi William

      This post is about 6 weeks old now but I just wanted to add my little experience from tonight. I was just updating my website with a few new useful and interesting links and I went off to a site which I thought was interesting and copied the URL into my page part of the url was :

      ?CurrentPage=1&;rhs”

      This was quite happily accepted by the site as expected but my caveat and warning is that I always get my website validated by W3C against the xhtml1-transitional.dtd…long story why but I teach the subject and have to be seen to practice what I teach. Anyway, back to the point my page would not validate purely because of the &, I therefore use the following:

      ?CurrentPage=1& amp;rhs” (space before amp there so Lounge Parser can view the code)

      and it was interpreted correctly, looks like W3C is getting strict now and just a top tip to add to yours.

      • #1046113

        I agree. W3C and others provide good online validators that I also use as a matter of course – even though they are pedantic at times (especially the CSS ones).

        • #1046115

          >even though they are pedantic at times (especially the CSS ones). grin

          …but isn’t it wonderful when you get it right…I have students shout “YEESSSSS” when they accomplish it for the first time and it is still fulfilling even now.

          Seriously though the CSS one is hard but very satisfying, hence why I try and stick to the same generic model CSS and chop and change the requirements. It is the hacks that are the pain.

    Viewing 1 reply thread
    Reply To: Numeric character references in href tags

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: