Numeric character reference

From WikiMD's Wellness Encyclopedia

Numeric character reference (NCR) is a common markup construct used in HTML and XML to reference characters in the Unicode standard by their corresponding number. This allows authors to include characters in their documents that cannot easily be typed on a keyboard or may not be directly supported by their document's character encoding.

Overview[edit | edit source]

A numeric character reference is composed of a series of characters that represent a specific character in a document. It starts with an ampersand (&), followed by a hash symbol (#), then the numeric value of the character, and ends with a semicolon (;). There are two types of numeric character references: decimal and hexadecimal. Decimal references are specified by the numeric value of the character, while hexadecimal references are prefixed with an "x" and use hexadecimal notation.

Decimal NCR[edit | edit source]

The decimal form of a numeric character reference is written as &# followed by the decimal number of the character and a semicolon. For example, the decimal NCR for the letter "A" is A.

Hexadecimal NCR[edit | edit source]

The hexadecimal form is written as &#x followed by the hexadecimal number of the character and a semicolon. For example, the hexadecimal NCR for the letter "A" is A.

Usage[edit | edit source]

Numeric character references are used for several reasons:

  • To display characters that are not available on the keyboard.
  • To include special characters that have specific meanings in HTML or XML, such as < and &, without being interpreted as markup.
  • To ensure characters are displayed correctly regardless of the document's character encoding.

Examples[edit | edit source]

  • The NCR for the copyright symbol © is © or ©.
  • To display a less-than sign (<) in HTML, you can use the NCR < or <.

Support[edit | edit source]

All modern web browsers and XML parsers support numeric character references, making them a reliable way to include special characters in web pages and XML documents.

See Also[edit | edit source]

WikiMD
Navigation: Wellness - Encyclopedia - Health topics - Disease Index‏‎ - Drugs - World Directory - Gray's Anatomy - Keto diet - Recipes

Search WikiMD

Ad.Tired of being Overweight? Try W8MD's physician weight loss program.
Semaglutide (Ozempic / Wegovy and Tirzepatide (Mounjaro / Zepbound) available.
Advertise on WikiMD

WikiMD's Wellness Encyclopedia

Let Food Be Thy Medicine
Medicine Thy Food - Hippocrates

Medical Disclaimer: WikiMD is not a substitute for professional medical advice. The information on WikiMD is provided as an information resource only, may be incorrect, outdated or misleading, and is not to be used or relied on for any diagnostic or treatment purposes. Please consult your health care provider before making any healthcare decisions or for guidance about a specific medical condition. WikiMD expressly disclaims responsibility, and shall have no liability, for any damages, loss, injury, or liability whatsoever suffered as a result of your reliance on the information contained in this site. By visiting this site you agree to the foregoing terms and conditions, which may from time to time be changed or supplemented by WikiMD. If you do not agree to the foregoing terms and conditions, you should not enter or use this site. See full disclaimer.
Credits:Most images are courtesy of Wikimedia commons, and templates Wikipedia, licensed under CC BY SA or similar.

Contributors: Prab R. Tumpati, MD