stringtranslate.com

List of XML and HTML character entity references

In SGML, HTML and XML documents, the logical constructs known as character data and attribute values consist of sequences of characters, in which each character can manifest directly (representing itself), or can be represented by a series of characters called a character reference, of which there are two types: a numeric character reference and a character entity reference. This article lists the character entity references that are valid in HTML and XML documents.

A character entity reference refers to the content of a named entity. An entity declaration is created in XML, SGML and HTML documents (before HTML5) by using the <!ENTITY name "value"> syntax in a Document type definition (DTD).

Character reference overview

In HTML and XML, a numeric character reference refers to a character by its Universal Character Set/Unicode code point, and uses the format:

&#xhhhh;

or

&#nnnn;

where the x must be lowercase in XML documents, hhhh is the code point in hexadecimal form, and nnnn is the code point in decimal form. The hhhh (or nnnn) may be any number of hexadecimal (or decimal) digits and may include leading zeros. The hhhh for hexadecimal digits may mix uppercase and lowercase letters, though uppercase is the usual style. However the XML and HTML standards restrict the usable code points to a set of valid values, which is a subset of UCS/Unicode code point values, that excludes all code points assigned to non-characters or to surrogates, and most code points assigned to C0 and C1 controls (with the exception of line separators and tabulations treated as white spaces).

In contrast, a character entity reference refers to a sequence of one or more characters by the name of an entity which has the desired characters as its replacement text. The entity must either be predefined (built into the markup language), or otherwise explicitly declared in a Document Type Definition (DTD) (see [a]). The format is the same as for any entity reference:

&name;

where name is the case-sensitive name of the entity. The semicolon is usually required in the character entity reference, unless marked otherwise in the table below (see [b]).

Standard public entity sets for characters

XML
XML specifies five predefined entities needed to support every printable ASCII character: &amp;, &lt;, &gt;, &apos;, and &quot;. The trailing semicolon is mandatory in XML (and XHTML) for these five entities (even if HTML or SGML allows omitting it for some of them, according to their DTD).
ISO Entity Sets
SGML supplied a comprehensive set of entity declarations for characters widely used in Western technical and reference publishing, for Latin, Greek and Cyrillic scripts. The American Mathematical Society also contributed entities for mathematical characters (see [c]).
HTML Entity Sets
Early versions of HTML built in small subsets of these, relating to characters found in three Western 8-bit fonts.
MathML Entity Sets
The W3C developed a set of entity declarations for MathML characters.
XML Entity Sets
The W3C MathML Working Group took over maintenance of the ISO public entity sets, combined with the MathML and documents them in XML Entity Definitions for Characters. This set can support the requirements of XHTML, MathML and as an input to future versions of HTML.
HTML5
HTML5 adopts the XML entities as named character references, however it restates them without reference to their sources and does not group them into sets. The HTML5 specification additionally provides mappings from the names to Unicode character sequences using JSON.

Numerous other entity sets have been developed for special requirements, and for major and minority scripts. However, the advent of Unicode has largely superseded them.

List of character entity references in HTML

HTML5 defines many named entities, references to which act as mnemonic aliases for certain Unicode characters.[1] The HTML5 specification does not allow users to define additional entities, as it no longer accepts any DTD to be referenced or extended inside HTML documents (this is still needed in XHTML, which is based on stricter XML parsing rules but allows referencing or defining a DTD in the document header, because XML does not predefine most HTML entities).

In the below table, the "Standard" column indicates the first version of the HTML DTD that defines the character entity reference, and indicates characters that are predefined in XML without needing any DTD. To use one of these character entity references in an HTML or XML document, enter an ampersand (&) followed by the entity name, and a semicolon (mandatory in XML, and strongly recommended in HTML for all entities, even if HTML allows omitting the semicolon only from some entities indicated below by [b]), e.g., enter &copy; for the copyright symbol ©.

There are no predefined character entities in HTML for characters or sequences of most scripts encoded in the UCS (except a common subset of whitespace, punctuation, mathematical or technical symbols, currency symbols, a few Hebrew symbols used in mathematical notations, and the most common letters in Latin, Greek or Cyrillic). Note also that not all bidirectional controls defined in UCS/Unicode are represented as standard character entities in HTML (not even in HTML5, which defines more general directional elements and attributes for that purpose). Notably, there are no predefined HTML character entities for controls that were added in the UCS/Unicode and formally defined in version 2 of the Unicode Bidi Algorithm.

Most entities are predefined in XML and HTML to reference just one character in the UCS, but there are no predefined entities for isolated combining characters, variation selectors, or characters for private use assignments; however the list includes some predefined entities for character sequences of two characters containing some of them. Since HTML 5.0 (and MathML 3.0 which shares the same set en entities), all entities are encoded in Unicode normalization forms C and KC (this was not the case with older versions of HTML and MathML, so older entities that were initially defined with characters for private use assignments, CJK compatiblity forms, or in non-NFC forms were modified[2]).

However, all valid characters and sequences in the UCS, including all bidirectional controls or private-use assignments (but with the exception of non-whitespace C0 and C1 controls, non-characters, and surrogates) are also usable and valid in HTML, XML, XHTML and MathML, either in plain-text values of attributes or in text elements (by encoding them directly as plain text, or using numeric character references when needed).

Notes

  1. ^ a b DTD: see § Formal public identifiers for HTML DTD entities subsets
  2. ^ a b c d e f g h i j k l m n o p q r s t u v w x y z aa ab ac ad ae af ag ah ai aj ak al am an ao ap aq ar as at au av aw ax ay az ba bb bc bd be bf bg bh bi bj bk bl bm bn bo bp bq br bs bt bu bv bw bx by bz ca cb cc cd ce cf cg ch ci cj ck cl cm cn co cp cq cr cs ct cu cv cw cx cy cz da db dc dd The trailing semicolon may be omitted for this named entity.
  3. ^ a b Old ISO subset: see § Formal public identifiers for old ISO entities subsets
  4. ^ Description: the standard ISO 10646 and Unicode character name is displayed first for each character, with non-standard but legacy synonyms shown in italics between parentheses after an equal sign.
  5. ^ a b c The leading space before combining characters used in old DTDs for MathML2.0 was removed in MathML 3.0 and HTML 5.0.
  6. ^ &quot; was omitted from the HTML 3.2 specification,[1] but was restored as of HTML 4.0.[2] In practice, most web browsers displaying HTML 3.2 pages render it as if it had been included in the spec.
  7. ^ a b c d spaces: a blue background is used to display each space's width.
  8. ^ &copy;: U+00A9 'copyright symbol' is not the same as U+24B8 'circled Latin capital letter C', although the same glyph could be used do depict both characters. See also U+24D2 'Latin small letter c'.
  9. ^ &reg;: U+00AE 'registered sign' is not the same as U+24C7 'circled Latin capital letter R', although the same glyph could be used do depict both characters.
  10. ^ &angst;: The use of U+212B 'Angstrom sign', which was encoded due to round-trip mapping compatibility with an East-Asian character encoding, is discouraged, and the preferred representation is U+00C5 'capital letter A with ring above', which has the same glyph.
  11. ^ a b &IJlig; and &ijlig;: The use of U+0132 'IJ ligature' or U+0133 'ij ligature', which were encoded for usage in Dutch and for compatibility for ISO/IEC 6937 and Code page 1102 (which only includes the lowercase ij, also part of the Dutch version of ISO 646 National Replacement Character Set), is discouraged, and the preferred representation is simply 'IJ' or 'ij' (as two separate letters).
  12. ^ a b &lmidot;: The use of U+013F 'Latin small letter l with middle dot' or U+0140 'Latin capital letter L with middle dot', which were encoded for usage in Catalan and for compatibility for ISO/IEC 6937, is discouraged, and the preferred representation is 'L' or 'l', followed by U+00B7.
  13. ^ &napos;: The use of U+0149 'n preceded by apostrophe', which was encoded for usage in Afrikaans and for compatibility for ISO/IEC 6937, has been deprecated by Unicode (since Unicode 5.2), and the preferred representation is ʼn (U+02BC followed by n). (Unicode.org – Proposal for Additional Deprecated Characters).
  14. ^ a b ligature: this is a standard misnomer as this is a separate character in some languages.
  15. ^ a b c d e f g h i j k l m n o p q r s t u v w x y z aa ab ac ad ae af ag ah ai aj ak al am an ao ap aq ar as at au av aw Greek letters: the ISOgrk1 set includes a set of entity names for the entire Greek alphabet (without diacritics),[3] while the ISOgrk3 set includes a different set of entity names for the subset of the Greek letters used contrastively with Latin letters in mathematical notation.[4] The HTML HTMLsymbol set includes an expanded version of the ISOgrk3 set, not the ISOgrk1 set.
  16. ^ &ohm;: The use of U+2126 'ohm sign', is discouraged, and the preferred representation is U+03A9 'Greek capital letter Omega', which has the same glyph.
  17. ^ a b c d &NegativeMediumSpace;, &NegativeThickSpace;, &NegativeThinSpace;, &NegativeVeryThinSpace;: these are names used in the Wolfram Language for Private Use Area characters with negative advance widths;[5][6][7][8] HTML5 approximates them with the zero-width space.
  18. ^ a b c d e black: here it seems to mean filled as opposed to hollow.
  19. ^ a b ISO proposed: these characters have been standardized in ISO 10646 after the release of HTML 4.0.
  20. ^ a b c d &image;, &map;: these two entity names were defined differently, as file-type icons, in the abandoned specification for HTML version 3.0.[9][10]
  21. ^ &copysr;: U+2117 'sound recording copyright' is not the same as U+24C5 'circled Latin capital letter P', although the same glyph could be used do depict both characters.
  22. ^ &alefsym;: U+2135 'alef symbol' is not the same as U+05D0 'Hebrew letter alef', although the same glyph could be used to depict both characters.
  23. ^ &beth;: U+2136 'bet symbol' is not the same as U+05D1 'Hebrew letter bet', although the same glyph could be used to depict both characters.
  24. ^ &gimel;: U+2137 'gimel symbol' is not the same as U+05D2 'Hebrew letter gimel', although the same glyph could be used to depict both characters.
  25. ^ &daleth;: U+2138 'dalet symbol' is not the same as U+05D3 'Hebrew letter dalet', although the same glyph could be used to depict both characters.
  26. ^ &lArr;: ISO 10646 does not say that 'leftwards double arrow' is the same as the 'is implied by' arrow, but also does not have any other character for that function, so lArr can be used for 'is implied by' as ISOtech suggests.
  27. ^ &rArr;: ISO 10646 does not say that 'rightwards double arrow' is the same as the 'implies' arrow, but also does not have any other character with this function, so rArr can be used for 'implies' as ISOtech suggests.
  28. ^ &prod;: U+220F 'n-ary product' is not the same character as U+03A0 'Greek capital letter Pi' though the same glyph might be used for both.
  29. ^ &sum;: U+2211 'n-ary summation' is not the same character as U+03A3 'Greek capital letter Sigma' though the same glyph might be used for both.
  30. ^ &sim;: U+223C 'tilde operator' is not the same character as U+007E 'tilde', although the same glyph might be used to represent both.
  31. ^ &nsup;: U+2285 'not a superset of' is in the 'ISOamsn' subset, but is not covered by the Symbol font encoding, and is not listed in the HTML 4.0 entities list on the documentation, where it was erroneously omitted; it should be included for symmetry and analogy with other entities.
  32. ^ &perp;: Unicode only defines U+22A5 as the "up tack", and the Unicode symbol for "perpendicular" is U+27C2: the two symbols look similar, but are separate in Unicode. However, HTML uses U+22A5 as its "perpendicular" symbol: this is a discrepancy between HTML and Unicode. As well, the U+22A4 character (the "down tack" symbol) rendered in a browser such as Firefox 3.6 can match the font of either "up tack" or "perpendicular", but not both, depending on whether a fixed-width or a proportional font is used. When viewed in Firefox 3.6, the symbols rendered in the order U+22A5, U+22A4, U+27C2 in a proportional font: "⊥ ⊤ ⟂" and a fixed width one: ⊥ ⊤ ⟂, shows that the "down tack" has a similar look to U+22A5 (HTML's "perpendicular") in the first case but matches U+27C2 in the second. This exemplifies the difficulties of the semiotics involved in interpreting glyphs, symbols and characters generally.
  33. ^ &sdot;: U+22C5 'dot operator' is not the same character as U+00B7 'middle dot'.
  34. ^ &Ll;: U+22D8 'very much less-than' is missing in the HTML 5.2 list of entities, where it was omitted.
  35. ^ &lang;: U+27E8 'mathematical left angle bracket' is not the same character as U+003C 'less than', U+2039 'single left-pointing angle quotation mark', or U+3008 'left angle bracket'. In HTML 5.0, lang was remapped to this code, as U+2329 'left-pointing angle bracket' has been marked deprecated in Unicode (since version 5.2) (Unicode.org – Proposal for Additional Deprecated Characters).
  36. ^ &rang;: U+27E9 'mathematical right angle bracket' is not the same character as U+003E 'greater than', U+203A 'single right-pointing angle quotation mark', or U+3009 'right angle bracket'. In HTML 5.0, rang had been remapped to this code, as U+232A 'right-pointing angle bracket' has been marked deprecated in Unicode (since version 5.2) (Unicode.org – Proposal for Additional Deprecated Characters).

Formal public identifiers for HTML DTD entities subsets

The full formal public identifier and system identifier for the DTD entities subset (where the character entity name is defined) is actually mapped from one of the following three defined named entities:

  1. ^ The original HTML 1.0 DTD, which would have been available at http://info.cern.ch/MarkUp/html-spec/html.dtd
  2. ^ There is no DTD for HTML 5, where all entities are predefined; it is impossible to strictly validate in XML the schema needed for (X)HTML 5, without also defining custom XSD's (at least for the custom "data-*" attributes). Rather than requiring support for a DTD (with the associated security concerns such as billion laughs), the best way to securely interchange HTML5 with XHTML is to convert all entity references to plain-text, numerical character references, or (where applicable) the five standard entities of XML 1.0. That being said:
    • The HTML 5 entity set is also used in MathML 3 and, for that purpose, its DTD entities subset is assigned the identifier set PUBLIC "-//W3C//ENTITIES HTML MathML Set//EN//XML" "http://www.w3.org/2003/entities/2007/htmlmathml-f.ent".[11]
    • The WHATWG specification encourages browsers to map the formal public identifiers for MathML 2 or XHTML 1.x (when used in XML) to a data URI containing the HTML5 entity set, and give this precedence over the provided system identifier, so as to "handle entities in an interoperable fashion without requiring any network access".[12]

Formal public identifiers for old ISO entities subsets

The ISO entities subsets are old (documented) character subsets, which are given SGML character entity names in ISO 8879 and ISO 9573, and which were used in legacy encodings before the unification within ISO 10646. Their full formal public identifiers are as follows:

  1. ^ a b c d e f g h i j k l m n o p q r s A version beginning with ISO 8879-1986// instead of ISO 8879:1986// is considered deprecated.[13]
  2. ^ A version with appended //HTML is sometimes erroneously used for the larger HTMLlat1 entity set, i.e. instead of "-//W3C//ENTITIES Latin 1//EN//HTML"[13] (see above).

Entities representing special characters in XHTML

The XHTML DTDs explicitly declare 253 entities (including the 5 predefined entities of XML 1.0) whose expansion is a single character, which can therefore be informally referred to as "character entities". These (with the exception of the &apos; entity) have the same names and represent the same characters as the 252 character entities in HTML 4.0. Also, by virtue of being XML, XHTML documents may reference the predefined &apos; entity, which is not one of the 252 character entities in HTML 4.0. Additional entities of any size may be defined on a per-document basis. However, the usability of entity references in XHTML is affected by how the document is being processed:[citation needed]

Because of the special &apos; case mentioned above, only &quot;, &amp;, &lt;, and &gt; will work in all XHTML processing situations.

See also

References

  1. ^ "HTML5 Named Character Reference List".
  2. ^ "XML Entity Definitions for Characters (3rd Edition) - § C Differences between these entities and earlier W3C DTDs".
  3. ^ Organization for the Advancement of Structured Information Standards (OASIS) (2002). "ISO Greek Letters Entities V0.3". Debian.
  4. ^ Organization for the Advancement of Structured Information Standards (OASIS) (2002). "ISO Greek Symbols Entities V0.3". Debian.
  5. ^ Wolfram. "\[NegativeThickSpace]". Wolfram Language Documentation.
  6. ^ Wolfram. "\[NegativeMediumSpace]". Wolfram Language Documentation.
  7. ^ Wolfram. "\[NegativeThinSpace]". Wolfram Language Documentation.
  8. ^ Wolfram. "\[NegativeVeryThinSpace]". Wolfram Language Documentation.
  9. ^ Hannah, Michael J. (7 December 1995). "HTML Icons: Proposed HTML Icon Entity Names". Archived from the original on 2 February 2015.
  10. ^ "Standard ISO/WWW icons courtesy of Bert Bos and Kevin Hughes". W3C.
  11. ^ "htmlmathml-f entity set". W3C. 2011.
  12. ^ "14.2 Parsing XML documents". HTML Standard. WHATWG. Retrieved 13 July 2024.
  13. ^ a b c d e f g h i j k l m n o p q r s t u "sgml-iso-entities-8879.1986/catalog". Debian. 2013.
  14. ^ a b c d e f g h i j k l m "sgml-iso-entities-9573-13.1991/catalog". Debian. 2013.

Further reading

External links