Character reference or entity references?

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
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?

Re: Character reference or entity references?

C Davis wrote:

Quoted text here. Click to load it

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).


Re: Character reference or entity references?

Quoted text here. Click to load it

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 (&, < etc., but not ' 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.

Site Timeline