Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Click here to return to the 'A caution on Spotlight searches and ampersands' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
A caution on Spotlight searches and ampersands
Authored by: Anonymous on Sep 25, '08 11:46:42AM

FYI: My wife's a highly talented Web designer, and she uses the numeric codes in preference to the mnemonic versions for a very good reason, which for the life of me I cannot remember just now.

It's partly to do with the mnemonics being a Microsoftism, and not fully ratified in the Web standards; yet they pass muster in the W3C's validator. But that's not the end of the story.

[ Reply to This | # ]
A caution on Spotlight searches and ampersands
Authored by: lar3ry on Sep 27, '08 08:37:28PM
OK, here's the scoop...

Unless your DTD allows for named entity codes (like —) then you have to use the numeric entities. Otherwise, they aren't defined.

XML only requires five named entities (in order to "escape" the special characters in XML). Those named entities are ' (apostrophe, or single quote), " (double-quote), & (ampersand), < (less than), and > (greater than). Those entities are "inherited" by all XML-based languages.

HTML and XHTML, on the other hand, have nearly 250 named entities defined. The names are easy to remember once you see their "description" in English (— is an em-dash, for example). You can see all those useful HTML/XHTML named entities in a handy list at Wikipedia:

When working with various XML or SGML-based markup languages, the numeric entities are universal. THAT is the reason why some people use numeric entities exclusively--they are guaranteed to work. The numbers in the entities refer to the 16-bit UNICODE value for the character.

[ Reply to This | # ]