List of XML and HTML character entity references

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.

Character reference overview

A "numeric character reference" refers to a character by its Universal Character Set/Unicode "code point", and uses the format

:&#"nnnn";or:&#x"hhhh";

where "nnnn" is the code point in decimal form, and "hhhh" is the code point in hexadecimal 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" which has the desired character as its "replacement text". The entity must either be predefined (built-in to the markup language) or explicitly declared in a Document Type Definition (DTD). The format is the same as for any entity reference:

:&"name";

where "name" is the name of the entity. The semicolon is required.

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 "Name" column mentions the entity's name. The "Character" column shows the character, if it is renderable. In order 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 "Description" column cites the character via its canonical UCS/Unicode name, in English.

Character entities in HTML

The HTML 4 DTD explicitly declares 252 character entities. HTML processors must honor the HTML DTD's declarations, even if the DTD is not mentioned in the HTML document. HTML does not allow other named entities to be defined.

HTML document authors who have been exposed to XML and XHTML often overlook the fact that the apos entity is not defined in HTML. rsquo is the best alternative in this case (but it is not the same character), or authors can use a numeric character reference instead (' or ' which always designate the character using the numeric value of its Unicode code point, independently of the actual document encoding).

In the table below, the HTML built-in character entities are listed. The columns are as in the XML entity table, above, except "Standard" column indicates the first version of HTML that includes the entity. The version is one of the major releases of the HTML spec: 2.0, 3.2, or 4.0. HTML 4.01 didn't introduce any new entities.

Notes:
* DTD: the full public DTD name (where the character entity name is defined) is actually mapped from one of the following three defined named entities:
*; HTMLlat1: maps to:
*:* PUBLIC "-//W3C//ENTITIES Latin 1//EN//HTML" in HTML (the DTD is implicitly defined, no system URI is needed);
*:* PUBLIC "-//W3C//ENTITIES Latin 1 for XHTML//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml-lat1.ent" in XHTML 1.0;
*; HTMLsymbol: maps to:
*:* PUBLIC "-//W3C//ENTITIES Symbols//EN//HTML" in HTML (the DTD is implicitly defined, no system URI is needed);
*:* PUBLIC "-//W3C//ENTITIES Symbols for XHTML//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml-symbol.ent" in XHTML 1.0;
*; HTMLspecial: maps to:
*:* PUBLIC "-//W3C//ENTITIES Special//EN//HTML" in HTML (the DTD is implicitly defined, no system URI is needed);
*:* PUBLIC "-//W3C//ENTITIES Special for XHTML//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml-special.ent" in XHTML 1.0.
* Old ISO subset: these are old (documented) character subsets used in legacy encodings before the unification within ISO 10646.
* 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)
* spaces: a blue background has been used in order to display each space's width.
* ISO proposed: these characters have been standardized in ISO 10646 after the release of HTML 4.0.
* ligature: this is a standard misnomer as this is a separate character in some languages.
* black: here it seems to mean filled as opposed to hollow.
* alefsym: 'alef symbol' is NOT the same as U+05D0 'Hebrew letter alef', although the same glyph could be used to depict both characters.
* 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.
* rArr: ISO 10646 does not say that 'rightwards double arrow' is the 'implies' character but does not have another character with this function so rArr can be used for 'implies' as ISOtech suggests.
* prod: 'n-ary product' is NOT the same character as U+03A0 'Greek capital letter Pi' though the same glyph might be used for both.
* sum: 'n-ary summation' is NOT the same character as U+03A3 'Greek capital letter Sigma' though the same glyph might be used for both.
* sim: 'tilde operator' is NOT the same character as U+007E 'tilde', although the same glyph might be used to represent both.
* sup: note that nsup, U+2283 'not a superset of', is not covered by the Symbol font encoding and is not included. Should it be, for symmetry? It is in the ISOamsn subset.
* sdot: 'dot operator' is NOT the same character as U+00B7 'middle dot'.
* lang: 'left-pointing angle bracket' is NOT the same character as U+003C 'less than' or U+2039 'single left-pointing angle quotation mark'.
* rang: 'right-pointing angle bracket' is NOT the same character as U+003E 'greater than' or U+203A 'single right-pointing angle quotation mark'.

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 ' entity) have the same names and represent the same characters as the 252 character entities in HTML. Also, by virtue of being XML, XHTML documents may reference the predefined ' entity, which is not one of the 252 character entities in HTML. 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 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 processing situations.

ee also

* Character encodings in HTML
* SGML entity

References

* [http://www.unicode.org/ Unicode Consortium] . See also: Unicode Consortium
** [http://www.unicode.org/Public/UNIDATA/UnicodeData.txt UnicodeData.txt from the Unicode Consortium]
* [http://www.w3.org/ World Wide Web Consortium] . See also: World Wide Web Consortium
** [http://www.w3.org/TR/REC-xml/ XML 1.0 spec]
** [http://www.w3.org/MarkUp/html-spec/html-spec_toc.html HTML 2.0 spec]
** [http://www.w3.org/TR/REC-html32 HTML 3.2 spec]
** [http://www.w3.org/TR/1998/REC-html40-19980424/ HTML 4.0 spec]
** [http://www.w3.org/TR/REC-html40/ HTML 4.01 spec]
** [http://www.w3.org/TR/xhtml1/ XHTML 1.0 spec]
* 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.

External links

* [http://www.babelstone.co.uk/Software/BabelPad.html BabelPad] a free Unicode text editor that supports many character sets
* [http://leftlogic.com/lounge/articles/entity-lookup/ HTML entities visual likeness tool]
* (for numerical references)


Wikimedia Foundation. 2010.

Игры ⚽ Нужно сделать НИР?

Look at other dictionaries:

  • Character entity reference — In the markup languages SGML, HTML, XHTML and XML, a character entity reference is a reference to a particular kind of named entity that has been predefined or explicitly declared in a Document Type Definition (DTD). The replacement text of the… …   Wikipedia

  • HTML — For the use of HTML on Wikipedia, see Help:HTML in wikitext. HTML (HyperText Markup Language) Filename extension .html, .htm Internet media type text/html Type code TEXT …   Wikipedia

  • Character encodings in HTML — For a list of character entity references, see List of XML and HTML character entity references. HTML HTML and HTML5 Dynamic HTML XHTML XHTML Mobile Profile and C HTML Canvas element Character encodings Document Object Model Font family HTML… …   Wikipedia

  • Entity — An entity is something that has a distinct, separate existence, though it need not be a material existence. In particular, abstractions and legal fictions are usually regarded as entities. In general, there is also no presumption that an entity… …   Wikipedia

  • Numeric character reference — A numeric character reference (NCR) is a common markup construct used in SGML and other SGML related markup languages such as HTML and XML. It consists of a short sequence of characters that, in turn, represent a single character from the… …   Wikipedia

  • SGML entity — In SGML and its derived markup languages HTML and XML, an entity is a named body of data associated with a document, or the unnamed document entity itself. Once defined, a named entity can be referenced any number of times within the document,… …   Wikipedia

  • Universal Character Set — The Universal Character Set (UCS), defined by the ISO/IEC 10646 International Standard, is a standard set of characters upon which many character encodings are based. The UCS contains nearly a hundred thousand abstract characters, each identified …   Wikipedia

  • Unicode and HTML — Web pages authored using hypertext markup language (HTML) may contain multilingual text represented with the Unicode universal character set.The relationship between Unicode and HTML tends to be a difficult topic for many computer professionals,… …   Wikipedia

  • Unicode — For the 1889 Universal Telegraphic Phrase book, see Commercial code (communications). The Unicode official logo since October 2009 …   Wikipedia

  • XML Certification Program — (XML Master) is IT professional certification for XML and related technologies. There are two levels of XML Certifications, XML Master Basic certification and XML Master Professional certification, and more than 16000 examiners have passed those… …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”