Flash读取XML文件出现的中文乱码问题 flash读取外部中文时显示乱码的问题

Flash读取XML文件出现的中文乱码问题 
 
原因:中文乱码,不用说都是编码惹的祸。Flash是使用UTF-8编码的。而一般我们保存文本文件时(也就是XML文件),用的编码是GB2321、ANSI或者Unicode。

有2种办法可以解决:
  1、XML文件用的编码,就是这一句“<?xml version="1.0" encoding="UTF-8"?>”注意后面的是“encoding="UTF-8"”。特别注意保存文件时,文件编码选择使用"UTF-8",,这样解析时就不会有乱码问题了。使用"Unicode"编码也可以,但这样文件量会相对比较大。

  2、在Flash脚本代码前面加上 System.useCodepage = true; 语句,但据说这是下下策的做法,不建议采用。

 

flash读取外部中文时显示乱码的问题 - [flashy]

版权声明:转载时请以超链接形式标明文章原始出处和作者信息及本声明
http://avant-contra.blogbus.com/logs/27551062.html

1 比较老的解决方案:

加一句: System.useCodepage = true;

此法已经不推荐使用, 这是让flash player使用操作系统的编码。如果系统本身就不支持外部文本的编码格式,则可能仍然是乱码。以下节选自《flash cs3 help 》:“Only use this process when you are loading non-Unicode encoded text from an external location and when this text is encoded with the same code page as the user’s computer.”

2 将外部文本用unicode进行编码:

这种做法应该更通用 。同样摘自《flash cs3 help》:“ To ensure that users on all platforms can view external text files used in your Flash applications, encode all external text files as Unicode and leave the system.useCodepage property set to false by default.”

评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值