Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Html Entity Name vs entity Number?

I saw this table : enter image description here

when I program Asp.net and want to display these special html entities , I use Entity Name.

(but both seems to work)

question :

in what scenarios should I use entity number ( and not entity name ) ?

p.s. Ive seen situation in which asp.net doesnt like Entity Number

like image 971
Royi Namir Avatar asked Apr 26 '12 18:04

Royi Namir


2 Answers

There is not clear guidance as to when one should use a numeric character reference (say £) over a character entity reference (say £) or vice versa.

So long as a character entity reference is a defined one (you can define your own), you can use it.

The converse is that if it isn't defined, you should use a numeric character reference.

like image 93
Oded Avatar answered Oct 14 '22 06:10

Oded


There is no need to use either of them for most characters. Just enter the characters, in UTF-8, or in ISO-8859-1, whichever you are using. If you don’t know how to type a no-break space, for example, and don’t want to learn it, the entity reference   and the character reference   are equivalent, so use whichever you find less confusing. (The latter is not an entity reference, so “Entity Number” is a misnomer.)

Only for “<” and for “&”, when used as data characters, will you need “escape” notations, and for them, I cannot figure out any reason why you would use character references, instead of the reasonably mnemonic entity references &lt; and &amp;.

like image 42
Jukka K. Korpela Avatar answered Oct 14 '22 05:10

Jukka K. Korpela