Flash and background coding problem solving new scheme

Source: Internet
Author: User
Tags character set mysql
Code | backstage | solve | problem

When the Flash MX began, it was often asked why flash loaded in Chinese will be garbled? Later, we all used system.usecodepage=true to solve the problem. Maybe everyone's got used to it. In Flash 5 or before, Flash completely ignored the coding time. Everyone may feel that I can easily load the external text when I am Flash5, and can easily interact with the background programs such as PHP, ASP and so on. But when it comes to Flash MX, the same method appears garbled. Be sure to add system.usecodepage=true before you can solve the problem.

Everyone may feel that this is a flash problem, I think the Flash MX Chinese support ability is poor. But the truth is just the opposite. Flash MX, Flash 2004 These versions of support for coding are definitely better than FLASH5. (Nonsense, Flash5 have no coding problems) you may have doubts about my words, it does not matter, let me explain the following.

As we all know, there are already two different codes in our country, namely Hong Kong, the BIG5 of Taiwan and the GB2312 of our mainland. In Flash 5 or before, Flash completely ignored the coding problem, all in the Dynamic/input TextField display of Chinese characters, Flash is based on the browser system preset code to display. Hong Kong generally uses BIG5 to encode text, and most people use traditional Chinese windows, so clicked can be displayed to Chinese. For Windows viewers in English or Simplified Chinese, they will not be able to display the BIG5 encoded Traditional Chinese on dynamic/input TextField. Previous English Windows users, often rely on the Chinese version of the program, such as: The Antarctic star or Richwin to see Chinese web pages, but this kind of software on the flash in the text can not work, is still garbled.

But starting with Flash MX, Flash is starting to support Unicode encoding.

Unicode

Unicode enables multiple languages to be in the same coding architecture, so it is possible to display simplified text and other text in the same article. Flash 6 (Flash MX) begins to support Unicode and converts Flash Player 6 or above to Unicode (if the SWF playing Flash 5 is still displayed according to the browser's system preset encoding), the novice is unaware of this change, dynamically loading the external file, For example:.

Loadvariablesnum ("Text.txt", 0);

Text.txt this file in Chinese with BIG5 encoding, Flash Player 6 with Unicode, the result is of course garbled.

There are two solutions:
One force flash to use "Flash 5 original Encoding method", add instruction in frame 1:

System.usecodepage = true;

If the entire SWF is using the "Flash 5 original Encoding Method", you can just start with frame 1.

Two uses Unicode encoding

Server-side programming:
1.php/coldfusion's developers
Please save your php/coldfusion as a UTF-8 code.
Text: File-> saved as-> encoding->utf-8
Dw2k4:file->new->preference...->default Encoding->utf-8

and add more on top.

<%@ codepage=65001%>

Demo Address:al4u.51.net/test.php

2.ASP of Developers
Please save your ASP as UTF-8 code.
Text: File-> saved as-> encoding->utf-8
Dw2k4:file->new->preference...->default Encoding->utf-8
and add more on top.

System.usercodepage=true;

After adding this command, the Flash file for Unicode will appear garbled. In other words, you can't encode it in Unicode. If you do not use UTF-8 encoding, for gb2312 encoding, it can be partially compatible with traditional Chinese and some Japanese code, that is because the gb2312 contains these encodings, that is, the so-called GBK large character set. This makes many people who use system.usercodepage feel that as long as the default encoding is gb2312, you can solve the coding problem. I misunderstood it when I was doing it because I didn't test other languages, like Korean. After trying the Korean, found that the text entered into the database into the% #5234;% #1243; The original encoding of these special languages was not found in the gb2312, so it was converted to byte encoding.

So, if you just want to let the traditional and simplified coding problem, then just use gb2312 encoding is enough, IE will help you convert Big5 to gb2312. And if you want to adapt to more language browsers, then you must use the universal code Unicode. It is worth noting, however, that some databases do not support Unicode. MySQL, for example, is now backed by MySQL. This requires a forced conversion of the encoding, either by using UrlEncode encoding, or by Base64. Code back to Unicode when reading. Also have to pay attention to the place, that is, flash inside the text box font can no longer use the song body. Instead, you need to use common fonts, such as Arial. Because other languages are not sung.



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.