Teaching and Learning with Technology

Computing With Accents and Foreign Scripts

Skip Menu

Unicode Numeric Codes

Thanks to Michael Czepiel for his technical input.

If you need to only insert a few special symbols or non-English words onto a mostly English page, you may find that you can insert it with a special entity code using the Unicode decimal numeric value. However, not all symbols are supported on all browsers, even recent ones. It is highly recommended that you preview your pages on a few browsers to see if they work.

Table of Contents

  1. Where are the Codes?
  2. The Steps
  3. Hex Calculators

Where are the Codes?

The Steps

Below are some steps for finding and inserting a numeric code.

1. Look Up the Character Code

The Unicode Consortium provides a series of P.D.F. charts organized by script block (e.g. Arabic, Greek, Math, etc). These charts provide the hexadecimal (base 16) codes. These  must be converted to decimal codes (Base 10) before being implemented

NOTE: Some Web sites may provide these special entity codes in Base 10 format. See links at the end of this page for some samples.

Determine if the number is Hexadecimal or Decimal

Either hexadecimal or decimal numbers can be used, but it is important to know because the entity code template differs slightly depending on whether you use hexadecimal or decimal.

2. Place in entity code template

The hexadecimal template is &#x<hex-number>; and the decimal template is &#<dec-number>; without the "x".

Notes: All codes begin with "&#" and end with a semicolon (;). A hexadecimal number is signaled by the use of "x" after the "#" sign. In addition, if a hexadecimal number is less than four digits, leading zeros must be added.

Example Entity Code

Entity Codes for Latin Capital Long A with Macron
Capital A with Macron (Ā) Numeric Code HTML Entity Code Result
Hexadecimal 100 &#x0100; Ā
Decimal 256 &#256; Ā

 

3. Declare Unicode encoding on the page 

Use the following code to declare that your HTML page is using

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
...
<head>

XHTML

The final close slash must be included after the finat quote mark in the encoding header tag if you are using XHTML

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
...
<head>

No Encoding Declared

If no encoding is declared, then the browser uses the default setting, which in the U.S. is typically Latin-1.Older browsers such as Netscape 4.7 may not be able to process the entity codes correctly without the "utf-8" declaration.

4. Test on Multiple Browsers/Platforms

Unicode is inconsistently implemented on different browsers and platforms. Make sure the characters you want to use can be displayed on both Windows and Macintosh and on Internet Explorer or Netscape (or any other browsers in common use). If you have LInux or Unix users, you need to test on those platforms as well.

Users whose browsers/platforms cannot see a particular character will display a "????" or empty boxes.

If users need access to special fonts, you can provide links to where they can be downloaded and instructions on how to install them on Windows and install them on Macintosh.

Top of Page

Tools for Converting Hexadecimal Numbers

Online

The following Web sites feature free hexadecimal conversion tools

Windows (XP)

You can use the free Calculator utility to convert hexadecimal number to decimal numbers. To use this tool:

  1. Open the Calculator utility from Start >> Accessories >> Calculator.
  2. Under the View menu, switch from Standard to Scientific to reveal more functions.
  3. Input a number and use the Dec and Hex toggles buttons to convert numbers back and forth.

Macintosh OS X

Calculator App (Tiger)

As of System 10.4 (if not earlier), the Calculator application includes hex convertion and Unicode conversion calculatior.

  1. Open the Calculator utility in the Applications folder.
  2. Under the View menu, switch from Basic to Programming to reveal more functions.
  3. Input a number and use the Dec and Hex toggles buttons to convert numbers back and forth.
  4. Click the Unicode button to display its equivalent Unicode glyph.

Other Calculators

Calculators shipped older Macintosh systems may not include hexadecimal conversion utilities. If that  is the case, you may want to use one of the free online calculators or download a shareware/freeware utility such as Hex Toaster.

Top of Page

Last Modified: Tuesday, 04-Jun-2013 12:41:35 EDT