Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Should I still use html entities? Why?

Tags:

Are HTML entities still useful or should I simply create UTF-8 encoded html documents? Please explain why.

like image 861
motobói Avatar asked Feb 06 '09 13:02

motobói


People also ask

Should you use HTML entities?

Entities are frequently used to display reserved characters (which would otherwise be interpreted as HTML code), and invisible characters (like non-breaking spaces). You can also use them in place of other characters that are difficult to type with a standard keyboard.

Why are HTML character entities necessary?

You use entities to help the parser distinguish when a character should be represented as HTML, and what you really want to show the user, as HTML will reserve a special set of characters for itself.


1 Answers

If the encoding is set correctly (and the document is saved as UTF-8) you should be able to work with just the characters. From the W3C:

Using an encoding such as UTF-8 means that you can avoid the need for most escapes and just work with characters.

http://www.w3.org/International/questions/qa-escapes

However, you still need to use entities for special characters such at greater/less than.

like image 139
Jack Sleight Avatar answered Sep 19 '22 13:09

Jack Sleight