Creating Multilanguage Text > Using external text or XML files that are not Unicode encoded

 

Using external text or XML files that are not Unicode encoded

If you load external files into a Flash Player 6 movie that are not Unicode encoded, the text in the external files will not display correctly when the Flash Player 6 attempts to display them as Unicode. You can tell the Flash Player 6 to use the traditional code page of the operating system that is running the player. To do this, add the following code as the first line of code in the first frame of the movie that is loading the data:

system.useCodepage = true;

Set the system.useCodepage property only once in a movie; do not use it multiple times in a movie to make the player interpret some external files as Unicode and some as other encoding, because doing so can yield unexpected results.

If you set system.useCodepage to true, keep in mind that the traditional code page of the operating system running the player must include the glyphs used in your external text file in order for the text to be displayed. For example, if you load an external text file that contains Chinese characters, those characters will not be displayed 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 movies, you should encode all external text files as Unicode and leave system.useCodepage set to false by default. This causes the Flash Player 6 to interpret the text as Unicode. For more information, see the entry for system.useCodepage in the online ActionScript Dictionary (Help > ActionScript Dictionary).