asdg>> technotes>> using special characters in actionscript

Version: Flash MX
Date Added: January 30, 2003
Updated: June 1, 2003

Flash Player 6 supports Unicode--a character set that includes characters from most of the world's languages. To include a special character in a string when publishing to Flash Player 6 or later, you can use a Unicode escape sequence of the format \uXXXX, where XXXX is the hexadecimal code point of the character you wish to include. A "code point" is simply a unique number that identifies a character in Unicode.

For example, the code point for the euro sign in hex is 20AC, so the following code displays a euro sign in the Output window:

trace("\u20AC");

The following code includes the em-dash character in a string for display in a text field called title_txt:

var title_txt.text = "Part One \u2014 My Life Story";

Code points for common "special" characters are listed below. Bear in mind that a character will only display correctly if the font you're embedding includes the character (or--when you're not embedding fonts--if the end user's font has the character).

Character                            Hex     Unicode
Description                          Code    Escape 
                                     Point   Sequence
=====================================================
copyright sign                       00A9    \u00A9
registered sign                      00AE    \u00AE
trademark sign                       2122    \u2122
em-dash                              2014    \u2014
euro sign                            20AC    \u20AC
curly single quotation mark (left)   2018    \u2018
curly single quotation mark (right)  2019    \u2019
curly double quotation mark (left)   201C    \u201C
curly double quotation mark (right)  201D    \u201D

If your character isn't in the table, you can look it up at the Unicode website. Here are some starting points for your search:

Unicode Code Charts
A collection of .pdf files that describe and visually depict the characters in Unicode.
Unicode Character Name Index
An alphabetical list of every character in Unicode, by human-readable name. If you know that your character is called, say "copyright", you can search for that name in this list using "Find" in your browser.
Unicode.org: Where is my character?
A helpful document suggesting ways to track down a character in the Unicode character set.
Unihan Database
The section of the Unicode Character Database that includes the code points for many Asian characters, including those in the Shift-JIS character set, Flash 5's supported set of Japanese characters.
Vendor Mappings
Lists vendor-specific code pages with corresponding Unicode character code points. If you know the code page used for text entry on your computer, this will help you find the characters you can type.