In
SGML
The Standard Generalized Markup Language (SGML; ISO 8879:1986) is a standard for defining generalized markup languages for documents. ISO 8879 Annex A.1 states that generalized markup is "based on two postulates":
* Declarative: Markup should des ...
,
HTML
The HyperText Markup Language or HTML is the standard markup language for documents designed to be displayed in a web browser. It can be assisted by technologies such as Cascading Style Sheets (CSS) and scripting languages such as JavaScri ...
and
XML
Extensible Markup Language (XML) is a markup language and file format for storing, transmitting, and reconstructing arbitrary data. It defines a set of rules for encoding documents in a format that is both human-readable and machine-readable. T ...
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 by using the
syntax in a Document Type Definition (DTD).
Character reference overview
A
numeric character reference
A numeric character reference (NCR) is a common markup construct used in SGML and SGML-derived markup languages such as HTML and XML. It consists of a short sequence of characters that, in turn, represents a single character. Since WebSgml, XML ...
refers to a character by its
Universal Character Set
The Universal Coded Character Set (UCS, Unicode) is a standard set of characters defined by the international standard ISO/IEC 10646, ''Information technology — Universal Coded Character Set (UCS)'' (plus amendments to that standard), whi ...
/
Unicode
Unicode, formally The Unicode Standard,The formal version reference is is an information technology Technical standard, standard for the consistent character encoding, encoding, representation, and handling of Character (computing), text expre ...
''code point'', and uses the format:
:''nnnn'';
or
:''hhhh'';
where ''nnnn'' is the code point in
decimal
The decimal numeral system (also called the base-ten positional numeral system and denary or decanary) is the standard system for denoting integer and non-integer numbers. It is the extension to non-integer numbers of the Hindu–Arabic numeral ...
form, and ''hhhh'' is the code point in
hexadecimal
In mathematics and computing, the hexadecimal (also base-16 or simply hex) numeral system is a positional numeral system that represents numbers using a radix (base) of 16. Unlike the decimal system representing numbers using 10 symbols, hexa ...
form. The x must be lowercase in XML documents. The ''nnnn'' or ''hhhh'' may be any number of digits and may include leading zeros. The ''hhhh'' may mix uppercase and lowercase, though uppercase is the usual style.
In contrast, a ''character entity reference'' refers to a character by the name of an ''
entity
An entity is something that exists as itself, as a subject or as an object, actually or potentially, concretely or abstractly, physically or not. It need not be of material existence. In particular, abstractions and legal fictions are usually ...
'' which has the desired character as its ''replacement text''. The entity must either be predefined (built into the markup language) or explicitly declared in a
Document Type Definition
A document type definition (DTD) is a set of ''markup declarations'' that define a ''document type'' for an SGML-family markup language ( GML, SGML, XML, HTML).
A DTD defines the valid building blocks of an XML document. It defines the document ...
(DTD). The format is the same as for any entity reference:
:&''name'';
where ''name'' is the case-sensitive name of the entity. The semicolon is required, unless marked otherwise in the table below (see
).
Standard public entity sets for characters
; ISO Entity Sets:
SGML
The Standard Generalized Markup Language (SGML; ISO 8879:1986) is a standard for defining generalized markup languages for documents. ISO 8879 Annex A.1 states that generalized markup is "based on two postulates":
* Declarative: Markup should des ...
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
The American Mathematical Society (AMS) is an association of professional mathematicians dedicated to the interests of mathematical research and scholarship, and serves the national and international community through its publications, meetings, ...
also contributed entities for mathematical characters.
; HTML Entity Sets: Early versions of
HTML
The HyperText Markup Language or HTML is the standard markup language for documents designed to be displayed in a web browser. It can be assisted by technologies such as Cascading Style Sheets (CSS) and scripting languages such as JavaScri ...
built in small subsets of these, relating to characters found in three Western 8-bit fonts.
; MathML Entity Sets: The
W3C
The World Wide Web Consortium (W3C) is the main international standards organization for the World Wide Web. Founded in 1994 and led by Tim Berners-Lee, the consortium is made up of member organizations that maintain full-time staff working to ...
developed a set of entity declarations for
MathML
Mathematical Markup Language (MathML) is a mathematical markup language, an application of XML for describing mathematical notations and capturing both its structure and content. It aims at integrating mathematical formulae into World Wide Web ...
characters.
; XML Entity Sets: The
W3C
The World Wide Web Consortium (W3C) is the main international standards organization for the World Wide Web. Founded in 1994 and led by Tim Berners-Lee, the consortium is made up of member organizations that maintain full-time staff working to ...
MathML Working Group took over maintenance of the ISO public entity sets, combined with the MathML and documents them i
XML Entity Definitions for Characters This set can support the requirements of
XHTML
Extensible HyperText Markup Language (XHTML) is part of the family of XML markup languages. It mirrors or extends versions of the widely used HyperText Markup Language (HTML), the language in which Web pages are formulated.
While HTML, prior ...
,
MathML
Mathematical Markup Language (MathML) is a mathematical markup language, an application of XML for describing mathematical notations and capturing both its structure and content. It aims at integrating mathematical formulae into World Wide Web ...
and as an input to future versions of HTML.
; HTML 5:
HTML5
HTML5 is a markup language used for structuring and presenting content on the World Wide Web. It is the fifth and final major HTML version that is a World Wide Web Consortium (W3C) recommendation. The current specification is known as the HTML ...
adopts the XML entities a
named character references however it restates them without reference to their sources and does not group them into sets. The HTML 5 specification additionally provides mappings from the names to Unicode character sequences using
JSON
JSON (JavaScript Object Notation, pronounced ; also ) is an open standard file format and data interchange format that uses human-readable text to store and transmit data objects consisting of attribute–value pairs and arrays (or other ser ...
.
Numerous other entity sets have been developed for special requirements, and for major and minority scripts. However, the advent of
Unicode
Unicode, formally The Unicode Standard,The formal version reference is is an information technology Technical standard, standard for the consistent character encoding, encoding, representation, and handling of Character (computing), text expre ...
has largely superseded them.
List of predefined entities in XML
The XML specification does not use the term "character entity" or "character entity reference". The XML specification defines five "predefined entities" representing special characters, and requires that all XML processors honor them. The entities can be explicitly declared in a DTD, as well, but if this is done, the replacement text must be the same as the built-in definitions. XML also allows other named entities of any size to be defined on a per-document basis.
The table below lists the five XML predefined entities. The initial "Name" column mentions the entity's name. The "Character" column shows the character. To render the character, the format
&name;
is used; for example,
&
renders as &. The "Unicode code point" column cites the character via standard UCS/Unicode "U+" notation, which shows the character's code point in hexadecimal. The decimal equivalent of the code point is then shown in parentheses. The "Standard" column indicates the first version of XML that includes the entity. The final "Name" column cites the character via its canonical UCS/Unicode name.
List of character entity references in HTML
The HTML 5 DTDs define many named entities, references to which act as mnemonic aliases for certain Unicode characters.
The HTML 5 specification requires the use of the standard DTDs and does not allow users to define additional entities.
In the table below, the "Standard" column indicates the first version of the HTML DTD that defines the character entity reference. 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'', e.g., enter
©
for the copyright symbol .
Alternatively, enter an ''ampersand'', followed by a ''number sign'', a ''number'' and a ''semicolon''. For example, to display the copyright symbol , enter
©
(When using this method, use the parenthesized decimal numbers in the third column.) Equivalently, you can enter an ''ampersand'', followed by a ''number sign'', the letter , a ''hexadecimal number'' and a ''semicolon''. For example, to display the copyright symbol , enter
©
or
©
. (When using this method, use the hexadecimal numbers in the third column, without the prefix
U+
.)
;Notes
Entities representing special characters in XHTML
The
XHTML
Extensible HyperText Markup Language (XHTML) is part of the family of XML markup languages. It mirrors or extends versions of the widely used HyperText Markup Language (HTML), the language in which Web pages are formulated.
While HTML, prior ...
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
'
entity) have the same names and represent the same characters as the
252 character entities in HTML. Also, by virtue of being
XML
Extensible Markup Language (XML) is a markup language and file format for storing, transmitting, and reconstructing arbitrary data. It defines a set of rules for encoding documents in a format that is both human-readable and machine-readable. T ...
, XHTML documents may reference the predefined
'
entity, which is not one of the 252 character entities in HTML 4. 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:
* If the document is read by a conforming HTML processor, then only the 252 HTML character entities can safely be used. The use of
'
or custom entity references may not be supported and may produce unpredictable results.
* If the document is read by an XML
parser
Parsing, syntax analysis, or syntactic analysis is the process of analyzing a string of symbols, either in natural language, computer languages or data structures, conforming to the rules of a formal grammar. The term ''parsing'' comes from Lati ...
that does not or cannot read external entities, then only the five built-in XML character entities (
see above) can safely be used, although other entities may be used if they are declared in the internal DTD subset.
* If the document is read by an XML parser that does read external entities, then the five built-in XML character entities can safely be used. The other 248 HTML character entities can be used as long as the XHTML DTD is accessible to the parser at the time the document is read. Other entities may also be used if they are declared in the internal DTD subset.
Because of the special
'
case mentioned above, only
"
,
&
,
<
, and
>
will work in all XHTML processing situations.
See also
*
Character encodings in HTML
While Hypertext Markup Language (HTML) has been in use since 1991, HTML 4.0 from December 1997 was the first standardized version where international characters were given reasonably complete treatment. When an HTML document includes special ch ...
*
Digraph and
Trigraph, a similar concept to enter unavailable characters
*
Escape character
In computing and telecommunication, an escape character is a character (computing), character that invokes an alternative interpretation on the following characters in a character sequence. An escape character is a particular case of metacharac ...
*
HTML decimal character rendering
While Hypertext Markup Language (HTML) has been in use since 1991, HTML 4.0 from December 1997 was the first standardized version where international characters were given reasonably complete treatment. When an HTML document includes special ch ...
*
Percent-encoding
Percent-encoding, also known as URL encoding, is a method to encode arbitrary data in a Uniform Resource Identifier (URI) using only the limited US-ASCII characters legal within a URI. Although it is known as ''URL encoding'', it is also used ...
, used in URLs
*
SGML entity
The Standard Generalized Markup Language (SGML; ISO 8879:1986) is a standard for defining generalized markup languages for documents. ISO 8879 Annex A.1 states that generalized markup is "based on two postulates":
* Declarative: Markup should de ...
References
{{Reflist
Further reading
Unicode Consortium See also:
Unicode Consortium
The Unicode Consortium (legally Unicode, Inc.) is a 501(c)(3) non-profit organization incorporated and based in Mountain View, California. Its primary purpose is to maintain and publish the Unicode Standard which was developed with the intenti ...
*
UnicodeData.txt from the Unicode ConsortiumWorld Wide Web Consortium See also:
World Wide Web Consortium
The World Wide Web Consortium (W3C) is the main international standards organization for the World Wide Web. Founded in 1994 and led by Tim Berners-Lee, the consortium is made up of member organizations that maintain full-time staff working to ...
*
XML 1.0 spec*
*
HTML 3.2 spec*
HTML 4.0 spec*
HTML 4.01 spec*
HTML 5 spec*
XHTML 1.0 spec*
XML Entity Definitions for Characters* The normative reference to RFC 2070 (still found in DTDs defining the character entities for HTML or XHTML) is historic; this RFC (along with other RFC's related to different part of the HTML specification) has been deprecated in favor of the newer informational RFC 2854 which defines the "text/html" MIME type and references directly the W3C specifications for the actual HTML content.
*
Numerical Reference of Unicode code points at Wikibooks
W3 HTML5 Character Reference Chart
External links
at the W3C
XML and HTML character entity references
HTML
XML
Unicode