Table of Contents

System.useCodepage Property Flash 6

force Flash Player to use the operating system's code page rather than Unicode read/write
System.useCodepage

Description

Unicode is an international character set comprising all the characters of the world's languages. Most modern applications, including Flash Player 6, use Unicode to manage and display text. Older applications, including Flash Player 5, manage text using the operating system's so called code page (essentially, a regional character set).

The System.useCodepage property controls:

When a non-Unicode application renders a character to the screen, it looks up the character by its code point in the system's current code page. The character displayed on screen is the one specified by the code page in use at display time. If the input code page (the one in effect when the character was input) does not match the display code page (the one in use when the application renders the character), the input character specified will likely not match the character displayed. The Unicode standard was introduced to solve this problem. Because Flash 6 uses Unicode, you should have no need for the System.useCodepage property as long as you:

The Boolean useCodepage property can force Flash Player 6 to use the operating system's current code page, rather than Unicode, when rendering text, as follows:

// Force use of the operating system's code page
System.useCodepage = true;

System.useCodepage can be modified at any time�for example, at the beginning and end of an operation that requires a legacy text encoding, such as loading an existing text file that uses a specific encoding.

When exporting Flash 6-format .swf files from the Flash MX authoring tool, it rarely is necessary to use the useCodepage property (Flash MX automatically converts text entered in the authoring tool to Unicode upon export). However, when the following conditions are both true, setting the useCodepage property to true will force non-Unicode text to display as intended:

The text will not display correctly if the operating system's current code page does not match the input code page! Though forcing the use of the operating system's code page may appear to magically fix text display problems on one computer, setting System.useCodepage to true almost never suitably addresses international text display issues. Hence, whenever possible, all external files should use Unicode, and useCodepage should be left at its default setting, false.

By default, most western Windows computers use code page CP1252 (WinLatin1). Mappings from CP1252 to Unicode can be found at:

http://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/CP1252.TXT

By default, most Japanese Windows computers use code page CP932 (Windows Shift-JIS). Mappings from CP932 to Unicode can be found at:

http://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/CP932.TXT

The complete list of Windows code pages is available at:

http://www.microsoft.com/globaldev/reference/WinCP.asp

For a partial list of code pages used by other vendors see:

http://czyborra.com/charsets/codepages.html

For more information on Unicode in Flash, see Section 4.5.1 in Chapter 4.

See Also

Section 4.5


Table of Contents