Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Whats the deal with the named html entity for $ ($)

I have a fairly simple question. There is a named HTML entity in most references for the dollar sign, and it is what you would expect it to be; $.

But in other references, this is missing, and tell you only the numeric entity is available ($).

As I remember, the named entity didn't exist for a long time because the $ is part of the standard ASCII set. And due to this earlier/older versions of IE and other browsers don't support this entity.

So what's the deal with this currently? I am looking for what the support for the named entity is and why this wasn't supported in the first place...

Here's a reference to all the currency symbols where strangely enough only the dollar doesn't have a named entity.

Here is a small example of what I am talking about when you use a dollar + int. And yes, I know that in this simple example I could have just escaped the dollar sign with a slash but believe me when I say that making it an entity when I save the string is the sanest solution in my case.

Regardless of my example, I am still curious what the support for the $ entity is.

like image 736
sg3s Avatar asked Oct 07 '11 08:10

sg3s


People also ask

What is the HTML entity for?

An HTML entity is a piece of text ("string") that begins with an ampersand ( & ) and ends with a semicolon ( ; ) . Entities are frequently used to display reserved characters (which would otherwise be interpreted as HTML code), and invisible characters (like non-breaking spaces).

Are HTML entities necessary?

If your pages are correctly encoded in utf-8 you should have no need for html entities, just use the characters you want directly.

Why does HTML use character entities?

Character entities are used to display reserved characters in HTML.


1 Answers

The official list of entities doesn't list it, so I'd file it under “some browsers may have had support for it, don't rely on it, though.”

Generally, entities were needed to represent non-ASCII characters when the document character set was limited by ASCII. Nowadays with UTF-8 the most frequent character set on the web I think we can finally move past named entities and just use the characters directly.

like image 108
Joey Avatar answered Nov 24 '22 03:11

Joey