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: ghay on Sep 25, '08 08:51:06AM

As a side note

–
—

both work in HTML, and would allow you to search for ndash or mdash in spotlight.



[ Reply to This | # ]
A caution on Spotlight searches and ampersands
Authored by: osxpounder on Sep 25, '08 09:02:25AM

I agree; that would be easier to deal with. Thanks for pointing that out for us. Those words are easier to remember than the numerical code.

Sadly, in my particular case, I can't use those codes -- I'm marking up XML, to be literal, but using whatever HTML markup the application allows. The application is one a coworker built in Flash a year or two ago.

Whether it's Flash's limitation or not, I don't know, but I can't use some HTML markup, including those. Sometimes testing shows that certain HTML markups aren't interpreted correctly, and I have to work around it.



[ Reply to This | # ]
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: http://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references

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 | # ]