Non-unicode external files, Enter asian characters on a western keyboard, Encoding text formats – Adobe Flash Professional CS3 User Manual

Page 286: Text encoding

Advertising
background image

FLASH CS3

User Guide

280

Non-Unicode external files

If you load external text or XML files that are not Unicode-encoded into a Flash Player 7 application, the text in the
external files does not appear correctly when Flash Player attempts to show them as Unicode. To tell Flash Player to
use the traditional code page of the operating system that is running the player, add the following code as the first
line of code in the first frame of the Flash application that is loading the data:

system.useCodepage = true;

Set the

system.useCodepage

property only once in a document; do not use it multiple times in a document to make

the player interpret some external files as Unicode and some as other encoding, because this can yield unexpected
results.

If you set the

system.useCodepage

property to

true

, the traditional code page of the operating system running the

player must include the glyphs used in your external text file for the text to appear. For example, if you load an
external text file that contains Chinese characters, those characters do not appear on a system that uses the CP1252
code page, because that code page does not include Chinese characters. To ensure that users on all platforms can view
external text files used in your Flash applications, encode all external text files as Unicode and leave the

system.useCodepage

property set to

false

by default. This causes Flash Player to interpret the text as Unicode.

For more information, see useCodepage (System.useCodepage property) in the ActionScript 2.0 Language Reference.

Enter Asian characters on a Western keyboard

With Flash, you can use Input Method Editors (IMEs) and standard Western keyboards to enter Asian characters on
the Stage. Flash supports more than two dozen IMEs.

For example, to create a website that reaches a broad range of Asian viewers, you can use a standard Western
(QWERTY) keyboard and change the IME to create text in Chinese, Japanese, and Korean.

Note: This feature affects only text input on the Stage, not text entered in the Actions panel. This feature is available for
all supported Windows operating systems and Mac OS X.

1

Select Edit > Preferences (Windows) or Flash > Preferences (Macintosh), and click Text in the Category list.

2

Under Input Method, select one of the options to input characters from a Western keyboard. The default is

Chinese and Japanese and it should also be selected for Western languages.

Encoding text formats

Text encoding

All text in a computer is encoded as a series of bytes. Many different forms of encoding (and therefore, different
bytes) represent text. Different kinds of operating systems use different kinds of encoding for text. For example,
Western Windows operating systems usually use CP1252 encoding; Western Macintosh operating systems usually
use MacRoman encoding; Japanese Windows and Macintosh systems usually use Unicode encoding.

Unicode can encode most languages and characters used throughout the world. The other forms of text encoding
that computers use are subsets of the Unicode format, tailored to specific regions of the world. Some of these forms
are compatible in some areas and incompatible in other areas, so using the correct encoding is critical.

Unicode has several forms. Flash Player versions 6 and 7 and later support text or external files in the 8-bit Unicode
format UTF-8, and in the 16-bit Unicode formats UTF-16 BE (Big Endian) and UTF-16 LE (Little Endian).

Advertising