Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why HTML decimal and HTML hex?

I have tried to Google quite a while now for an answer why HTML entities can be compiled either in HTML decimal or HTML hex. So my questions are:

  • What is the difference between HTML decimal and HTML hex?
  • Why are there two systems to do the same thing?
like image 515
kexxcream Avatar asked Jul 02 '13 12:07

kexxcream


1 Answers

Originally, HTML was nominally based on SGML, which has decimal character references only. Later, the hexadecimal alternative was added in HTML 4.01 (and soon implemented in browsers), then retrofitted into SGML in the Web Adaptations Annex.

The apparent main reason for adding the hexadecimal alternative was that all modern character code and encoding standards, such as Unicode, use hexadecimal notation for the code numbers of characters. The ability to refer to a character by its Unicode number, written in the conventional hexadecimal notation, just prefixed with &#x and suffixed with ;, helps to avoid errors that may arise if people convert from hexadecimal to decimal notation.

like image 197
Jukka K. Korpela Avatar answered Oct 03 '22 15:10

Jukka K. Korpela