9

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

Royi Namir
  • 144,742
  • 138
  • 468
  • 792

2 Answers2

8

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.

Oded
  • 489,969
  • 99
  • 883
  • 1,009
2

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;.

Jukka K. Korpela
  • 195,524
  • 37
  • 270
  • 390