| Su | Mo | Tu | We | Th | Fr | Sa |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | 5 | ||
| 6 | 7 | 8 | 9 | 10 | 11 | 12 |
| 13 | 14 | 15 | 16 | 17 | 18 | 19 |
| 20 | 21 | 22 | 23 | 24 | 25 | 26 |
| 27 | 28 | 29 | 30 | 31 |
Solving Flash multilanguage character encoding problem
the flash reads the output from php as Unicode encoding, and thus GB2312 characters were displayed as weird codes. to
solve this problem i found the following articles from the macromedia website:
Working with Multiple Languages
trick to use:
1. include system.useCodepage = true; in the first frame of the movie.
Condition: in order for this to work, the client’s operating system must use GB2312 encoding, otherwise the
string will still mess up. basically this statement tells flash player to use client’s operating system’s font encoding
instead of the default Unicode in flash player.
Advantages: quick and fast to make it work across all GB2312 platforms.
Disadvantages: if the client doesnt have a Simplified Chinese Windows system as his/her OS. too bad… just read
weird characters…
after several hours of digging… a second solution finally turns up…
2. use PHP’s iconv module (what a saver!) to convert the gb2312 encoding to the kind of unicode that flash can
understand (loading with LoadVars and put into a text variable or field as stated on the macromedia website)… no,
forget about mbstring, utf8_encode, etc… they suck and failed miserably….
Solution: iconv (”gb2312″, “utf-8″, $string)
Advantages: anyone can read the characters regardless of which OS
Disadvantages: time needed to put the codes to encode those particular gb2312 outputs in the source files …
As a good programmer… i’ll pick #2
最新评论