as3通过asp读access数据乱码:
asp加
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
编码ANSI
as3读取方式
var Requesturl:URLRequest=new URLRequest("http://127.0.0.1/getinfo.asp?page="+page+"&temp="+Math.random()* 10); var loader:URLLoader=new URLLoader(); loader.dataFormat=flash.net.URLLoaderDataFormat.BINARY; //loader.dataFormat=flash.net.URLLoaderDataFormat.TEXT; loader.addEventListener(Event.COMPLETE,xmlcomplete); loader.load(Requesturl); function xmlcomplete(e:Event) { var byte:ByteArray=new ByteArray(); byte.writeBytes(e.target.data); byte.position=0; var str:String=byte.readMultiByte(byte.length,"gb2312"); str = str.substr(str.indexOf("<"),str.lastIndexOf(">")+1); listxml=new XML(str); trace(str) }
as3写入access时
System.useCodePage=true; var request:URLRequest=new URLRequest("http://127.0.0.1/sendinfo.asp"); var variables:URLVariables=new URLVariables(); variables.book_name=input_boxs.input_name.text; variables.book_qq=input_boxs.input_qq.text; variables.book_mail=input_boxs.input_mail.text; variables.book_title=input_boxs.input_title.text; variables.book_info=input_boxs.input_info.text; request.data=variables; request.method = URLRequestMethod.POST; var loader:URLLoader=new URLLoader(); loader.dataFormat=URLLoaderDataFormat.TEXT; //loader.dataFormat=URLLoaderDataFormat.VARIABLES; loader.load(request);