Character reference or entity references?

C

C Davis

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?
 
J

Jukka K. Korpela

C said:
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).
 
A

Andy Dingley

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?

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top