Flash and background encoding problems solve new solutions

zhaozj2021-02-12  190

At the time of Flash MX, someone often asks why Flash loaded Chinese will be garbled? Later, everyone used System.usecodePage = True; to solve this problem. You may have been used to Flash 5 or before, Flash is completely ignored to encoding. Everyone may think that I can easily load external text when Flash5 can be easily interacting with the background program of PHP, ASP, and the like. But when it arrived in Flash MX, the same method did there was garbled. Be sure to add system.usecodepage = true; if you can solve the problem.

Everyone may feel that this is Flash problem, thinking that the Chinese support capacity of Flash MX is poor. However, the facts have just been opposite. Flash MX, Flash 2004 These versions are absolutely better than Flash5. (Nonsense, Flash5 does not have any encoded questions) You may have doubts about me, this is not tight, let me explain it below.

Everyone knows that there are already two different codes in our country, namely Hong Kong, Taiwan's BIG5 and GB2312 in our mainland. In Flash 5 or before, Flash is completely ignorant of the problem, all in the Chinese word displayed in Dynamic / Input TextField, Flash is based on the browser system preset encoding. Hong Kong usually uses BIG5 to encode text, and most people use traditional Chinese windows, so they can be displayed in Chinese. For English or Simplified Chinese Windows Viewers, they cannot display BIG5 encoding traditional Chinese on Dynamic / Input TextField. Previous English WINDOWS users, often rely on the Chinese program, such as the Antarctic Star or Richwin to read Chinese web pages, but unfortunately, this type of software can't work on the Chinese word in Flash, still garbled.

But starting from Flash MX, Flash began to support Unicode encoding. Unicodeunicode can support multi-country different texts in the same set of encoding architecture, so they can display the traditional Chinese characters and other texts in the same article. Flash 6 (flash MX) begins to support Unicode and encode Flash Player 6 or more to Unicode (if the SWF playing Flash 5 is still based on the browser system preset encoding), novice does not know this transformation, dynamic Load external files, for example:

Loadvariablesnum ("text.txt", 0);

TEXT.TXT This file is encoded in this file. Flash Player 6 uses unicode, and the result is of course displayed.

There are two solutions: one forced flash using "Flash 5 original coding method", add instructions in Frame 1: system.usecodepage = true; if the entire SWF is using "Flash 5 original coding method", just need to be Frame 1 It can be added once.

2 use Unicode encoding

Server programming: 1. The developer of Php / ColdFusion please save your PHP / ColdFusion to UTF-8 encoding. Text: File -> Save As -> Code -> UTF-8DW2K4: File-> New-> Preference ...-> default encoding-> UTF-8 demo address: Al4U.51.net/test.php

2. The developer of the 2.asp please save your ASP as UTF-8 encoding. Text: Document -> Save As -> Code -> UTF-8DW2K4: File-> New-> preference ...-> default encoding-> utf-8 then add <% @ codepage = 65001%> Demonstration: asp3.6to23.com/littlejie/test.asp Please don't add system.usercodepage = true in Flash;

After adding this instruction, Flash's file will be displayed as garbled. That is, you can't encode unicode. If UTF-8 is coded, it is possible to partially compatible with traditional Chinese and some Japanese codes for GB2312, because these codes have been included in GB2312, that is, the so-called GBK big character set. This makes many people using System.userCodepage feel that as long as the default is encoded as GB2312, you can solve the code problem. I was misunderstood when I was originally done, that is because I didn't test other languages, such as Korean. Later, after I tried Korean, I found that the text entered into the database became% # 5234;% # 1243; such a garbled. It turns out that these special language codes cannot be found in GB2312, so they are turned into byte coding.

So, if you just want to make there is no code between traditional Chinese characters and simplificions, it is enough to use GB2312 encoding, IE will help you convert BIG5 to GB2312. And if you want to adapt to more language browsers, you must use the general code Unicode. However, it is worth noting that some databases do not support Unicode. For example, the earlier MySQL, the current MySQL has been supported. This requires forced to convert the encoding, you can use the Urlencode encoding, or base64. Recouched back to Unicode when reading. There is also a place to pay attention to, that is, the text box font in Flash cannot use the Song. Instead, it is necessary to use public fonts such as Arial. Because other languages ​​do not have a Song

转载请注明原文地址:https://www.9cbs.com/read-7235.html

New Post(0)