Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Numeric character reference
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Discussion== Markup languages are typically defined in terms of UCS or Unicode characters. That is, a document consists, at its most fundamental level of abstraction, of a sequence of characters, which are abstract units that exist independently of any [[character encoding|encoding]]. Ideally, when the characters of a document utilizing a markup language are encoded for storage or transmission over a network as a sequence of [[bit]]s, the encoding that is used will be one that supports representing each and every character in the document, if not in the whole of Unicode, directly as a particular bit sequence. Sometimes, though, for reasons of convenience or due to technical limitations, documents are encoded with an encoding that cannot represent some characters directly. For example, the widely used encodings based on [[ISO 8859]] can only represent, at most, 256 unique characters as one 8-bit [[byte]] each. Documents are rarely, in practice, ever allowed to use more than one encoding internally, so the onus is usually on the markup language to provide a means for document authors to express unencodable characters in terms of encodable ones. This is generally done through some kind of [[escape character|"escaping" mechanism]]. The SGML-based markup languages allow document authors to use special sequences of characters from the ASCII range (the first 128 code points of Unicode) to represent, or ''reference'', any Unicode character, regardless of whether the character being represented is directly available in the document's encoding. These special sequences are ''character references''. Character references that are based on the referenced character's UCS or Unicode [[code point]] are called ''numeric'' character references. In HTML 4 and in all versions of [[XHTML]] and XML, the code point can be expressed either as a [[decimal]] (base 10) number or as a [[hexadecimal]] (base 16) number. The syntax is as follows: Character U+0026 ([[ampersand]]), followed by character U+0023 ([[number sign]]), followed by one of the following choices: * one or more decimal digits zero (U+0030) through nine (U+0039); or * character U+0078 ("x") followed by one or more hexadecimal digits, which are zero (U+0030) through nine (U+0039), Latin capital letter A (U+0041) through F (U+0046), and Latin small letter a (U+0061) through f (U+0066); all followed by character U+003B ([[semicolon]]). Older versions of HTML disallowed the hexadecimal syntax. The characters that comprise a numeric character reference can be represented in every character encoding used in computing and telecommunications today, so there is no risk of the reference itself being unencodable. There is another kind of character reference called a ''[[character entity reference]]'', which allows a character to be referred to by a name instead of a number. (Naming a character creates a ''character [[SGML entity|entity]]''.) HTML defines some character entities, but not many; all other characters can only be included by direct encoding or using NCRs.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)