Unicode and flash player – Adobe Flash Professional CS3 User Manual

Page 287

Advertising
background image

FLASH CS3

User Guide

281

Unicode and Flash Player

Flash Player 6 and later versions support Unicode text encoding. Users with Flash Player 6 or later can view multi-
language text, regardless of the language that the operating system running the player uses, if they have the correct
fonts installed.

Flash Player assumes that all external text files associated with a Flash Player application are Unicode encoded, unless
you tell the player otherwise.

For Flash applications in Flash Player 5 or earlier that are authored in Flash MX or earlier, Flash Player 6 and earlier
versions display the text by using the traditional code page of the operating system running the player.

For background information on Unicode, see Unicode.org.

Text encoding in Flash Player

By default, Flash Player 7 and later assumes that all text it encounters is Unicode encoded. If your document loads
external text or XML files, the text in these files should be UTF-8 encoded. Create these files by using the Strings
panel or using a text or HTML editor that can save the files in Unicode format.

Unicode encoding formats that Flash Player supports

When reading text data in Flash, Flash Player looks at the first two bytes in the file to detect a byte order mark
(BOM), a standard formatting convention used to identify the Unicode encoding format. If no BOM is detected, the
text encoding is interpreted as UTF-8 (an 8-bit encoding format). It is recommended that you use UTF-8 encoding
in your applications.

If Flash Player detects either of the following BOMs, the text encoding format is interpreted as follows:

If the first byte of the file is OxFE and the second is OxFF, the encoding is interpreted as UTF-16 BE (Big Endian).
This is used for Macintosh operating systems.

If the first byte of the file is OxFF and the second is OxFE, the encoding is interpreted as UTF-16 LE (Little
Endian). This is used for Windows operating systems.

Most text editors that can save files in UTF-16BE or LE automatically add the BOMs to the files.

Note: If you set the

system.useCodepage

property to

true

, the text is interpreted using the traditional code page of

the operating system that is running the player; it is not interpreted as Unicode.

Encoding in external XML files

You cannot change the encoding of an XML file by changing the encoding tag. Flash Player identifies the encoding
of an external XML file using the same rules as for all external files. If no BOM is encountered at the beginning of
the file, the file is assumed to be in UTF-8 encoding. If a BOM is encountered, the file is interpreted as UTF-16BE
or LE.

See also

“Non-Unicode external files” on page 280

Advertising