asp页面中怎么向txt文件里写汉字?

来源:百度知道 编辑:UC知道 时间:2024/06/21 03:41:30
各位兄弟姐妹你们好:
我现在的网站配置为:win2003+SQL2000sp2+IIS6,当运行如下asp程序时:
<%
set fso=server.createobject("scripting.filesystemobject")
set fc=fso.openTextFile(server.mappath("12.txt"),2,true)
for each element in request.form("C1")
fc.writeline (element)
next
fc.close
set fc=nothing
set fso=nothing
%>
就会提示出错:
“Microsoft VBScript 运行时错误 错误 '800a0005'
无效的过程调用或参数”
我要析了一下原因是element里有汉字,也就是说fc.writeline("我是中国人")都会出现这样的错误,但写fc.writeline("I am Chinese")就能正常写入。
大家能告诉我,怎么往txt文件里写汉字呢?
windscar你的方法根本就不行,不过谢谢你的回答
kaiguo85,我猜也是IIS的问题,因为我以前用winxp+iis5+sql200sp2可以写,但是编码在什么地方设置,adodb.stream对象方法,你能不能写个简单实例呢?谢谢。

查看一下IIS里面的编码,并对其进行设置
如果真的不行的话,建议改用adodb.stream对象。

element="啊打算打算大"
set fso=server.createobject("scripting.filesystemobject")
set fc=fso.openTextFile(server.mappath("12.txt"),2,true)
fc.writeline (element)
fc.close
set fc=nothing
set fso=nothing
这样就可以些了 你可以试一下先把表单元素给列出来 再写入

应该是服务器的设置问题.
确定你是简体中文的2003而不是英文的装了中文界面?