Menu:

Sponsor

Place your advertising here
casininio casino online casino online Buy and sell flash files

 

Forum's topics

Latest Files

Archives

Top Rated

Categories

Photo Gallery


Load XML files with special chars

Introducing

There are always lot of people get confused why flash when try to load external files with special characters inside (like accented chars) displays a square instead of the char. This is a common issue which almost everyone of us encountered using flash.
I too often read reply to message saying to use System.usecodepage in order to displat correctly the loaded text

1. Why System.useCodePage is not the correct way

System.usecodepage can be set to false or to true:
- When the command is set to false , the Flash Player 6 interprets external text files as Unicode. (These files must be encoded as Unicode when you save them.)
- When the command is set to true , the Flash Player 6 interprets external text files using the traditional code page of the operating system running the player.

If you set the codepage to true you are forcing the player to use the code page of your OS and probably all people using your same code page (for example latin-1) will see the loaded text in the same way you see it. But people using different code page will see the same text in another way.
This is the reason it's better to use unicode

Unicode provides a unique number for every character, no matter what the platform, no matter what the program, no matter what the language

 

2. A pratical example

Let's show a pratical example.
Now i will create an XML which will display some characters form different languages using the unicode charts and i will display that chars in a flash player textfield (note that some time in order to display text from different languages you Operating System need to install the support for them)

This is the XML i created (look at the source code)

Take a look at the XML source too.
The browser display characters in the correct way too. In fact for example, in order to display the letter "Ă" i used the code Ă

 

3. Conclusion

Using System.usecodepage is never the right solution, it's pratical sometime, but I will never suggest it

 

Download files used in this tutorial