Character reference or entity references?

Discussion in 'HTML' started by C Davis, Feb 3, 2009.

  1. C Davis

    C Davis Guest

    Hi. When I insert (say) a dash in Dreamweaver, it uses the character
    reference – rather than the entity reference – . Is there a
    good reason to use the character reference form rather than the more
    readable entity reference?
    C Davis, Feb 3, 2009
    #1
    1. Advertising

  2. C Davis wrote:

    > Hi. When I insert (say) a dash in Dreamweaver, it uses the character
    > reference – rather than the entity reference – . Is there
    > a good reason to use the character reference form rather than the more
    > readable entity reference?


    Not really, except that the entity reference needs an entity definition.
    When playing with HTML, browsers are assumed to imply the definitions as per
    HTML specifications. But when the data is processed by general XML tools,
    such definitions might not be present.

    Regarding readability, the en dash character itself is more readable than
    any of the alternatives. Of course, the character encoding needs to be
    correctly specified, and page editing needs to be done using software that
    can handle the encoding that would be used (normally UTF-8).

    --
    Yucca, http://www.cs.tut.fi/~jkorpela/
    Jukka K. Korpela, Feb 3, 2009
    #2
    1. Advertising

  3. C Davis

    Andy Dingley Guest

    On 3 Feb, 14:35, C Davis <> wrote:
    > Hi. When I insert (say) a dash in Dreamweaver, it uses the character
    > reference – rather than the entity reference &ndash; . Is there a
    > good reason to use the character reference form rather than the more
    > readable entity reference?


    Use the character entity references rather than the numerics, as
    they're more readable. Do this _provided_that_ there are suitable
    character entity references for all of the characters you need to use.

    If you're forced into using numerics, then that's probably time to
    make sure your editing / publishing / serving process is UTF-8 clean
    and then switch entirely to that. It's far easier to edit foreign
    language content this way than dealing with codes.

    It's still a good idea to use the "XML set" of character entity
    references (&amp;, &lt; etc., but not &apos; for HTML) as it provides
    a little protection against idiot parsers, even though this isn't a
    character encoding issue so much as a syntactic one.
    Andy Dingley, Feb 3, 2009
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    2
    Views:
    478
  2. Samuel van Laere

    Entity Name or Entity Number?

    Samuel van Laere, Feb 24, 2007, in forum: HTML
    Replies:
    4
    Views:
    1,616
    Jukka K. Korpela
    Feb 24, 2007
  3. markla
    Replies:
    1
    Views:
    540
    Steven Cheng
    Oct 6, 2008
  4. User Axes Dean Eyed

    Character Entity References & DOM

    User Axes Dean Eyed, Oct 6, 2004, in forum: Javascript
    Replies:
    1
    Views:
    151
    Michael Winter
    Oct 7, 2004
  5. Jim Higson
    Replies:
    3
    Views:
    112
    Jim Higson
    Mar 13, 2005
Loading...

Share This Page