The solution of swfupload garbled problem

Source: Internet
Author: User

The most popular is the use of the SWFUpload control, the detailed introduction of this control can be found on the official website http://demo.swfupload.org/v220/index.htm

In the use of this control bulk upload files found in Chinese filenames are garbled, on-line search for a half-day, find a few ways, special summary as follows:

First type: filename= new String (Filename.getbytes ("UTF-8"), "GBK");

In this way, most of the garbled characters can be solved, but if there is a special character and punctuation in the file name, it can sometimes be turned around.

The second type: I'm using this method, the test has passed

View Plaincopy to Clipboard
  1. /** you need to set up an upload event when setting up
  2. *upload_start_handler:this.onuploadstart,
  3. * Dynamic transmission of parameters, solve the problem of Chinese characters garbled file name
  4. **/
  5. Onuploadstart:function (file) {
  6. var post_params = This.settings.post_params;
  7. Ext.apply (post_params,{
  8. ' fileName ': encodeURIComponent (file.name)
  9. });
  10. This.setpostparams (Post_params);
  11. }
  12. Transcode the files in the class you read
  13. String fName = Urldecoder.decode (FileName, "UTF-8");
[C-sharp]View Plaincopy
  1. /** you need to set up an upload event when setting up
  2. *upload_start_handler:this.onuploadstart,
  3. * Dynamic transmission of parameters, solve the problem of Chinese characters garbled file name
  4. **/
  5. Onuploadstart:function (file) {
  6. var post_params = This.settings.post_params;
  7. Ext.apply (post_params,{
  8. ' fileName ': encodeURIComponent (file.name)
  9. });
  10. This.setpostparams (Post_params);
  11. }
  12. Transcode the files in the class you read
  13. String fName = Urldecoder.decode (FileName, "UTF-8");

Third: Configure the Web. config configuration file this way

SWFUpload is encoded according to Utf-8, and the Chinese site is generally used by the code is gb2312, you need to use the Sufupload program file directory to redefine the Xml.comfig file, as follows: [HTML]View Plaincopyprint?
  1. <configuration>
  2. <appSettings/>
  3. <connectionStrings/>
  4. <system.web>
  5. <globalization requestencoding="utf-8"/>
  6. </system.web>
  7. </configuration>
<configuration>    <appSettings/>    <connectionStrings/>    <system.web>      < Globalization requestencoding= "Utf-8"/>    </system.web></configuration>

Now the latest flash version, 11.8.800.168 and 11.9 and other bugs, if the upgrade, in the use of Swfuploader, uploadify and other file upload control, if the file name is Chinese, will appear in Chinese garbled. You can know the SWFUpload and uploadify the official website of the demo test.

If you have accidentally upgraded, you can solve the following methods:

      1. Here to download the anti-installation files and uninstall the current version of Flash (by other means uninstall will not install the old version of The Flash Control): http://download.macromedia.com/get/flashplayer/current/ Support/uninstall_flash_player.exe
      2. Here to download the relatively old version, and install (can also go to other places to download): Http://file.myfiles.com.cn/Photo/FlashPlayer_v118800129X.zip

The solution of swfupload garbled problem

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.