≮崩溃≯不劳阁,俺的blog纯粹属于好玩,如有雷同 纯属巧合!
9 Dec
仅针对asp!!!
正常的fso生成静态(gb2312)的用一下函数:
function bytestobstr(body,cset)
dim objstream
set objstream = server.createobject("adodb.stream")
objstream.type = 1
objstream.mode =3
objstream.open
objstream.write body
objstream.position = 0
objstream.type = 2
objstream.charset = cset
bytestobstr = objstream.readtext
objstream.close
set objstream = nothing
end function
而如果是生成utf8格式的,还是以上函数将会出现乱码!!!
找过很多方法都不奏效,其实很简单,仔细看createtextfile函数会发现最后还有一个参数,在生成的时候加一个参数立即搞定!
example: set fsocreatefile = fso.createtextfile(server.mappth(file),true,true)
createtextfile 方法
创建指定的文件名并返回一个 textstream 对象,可以使用这个对象对文件进行读写。
object.createtextfile( filename [, overwrite[, unicode]] )
参数
object:必选项。 应为 filesystemobject 或 folder 对象的名称。
filename:必选项。 指明所要创建文件的字符串表达式。
overwrite:可选项。 boolean 值,指明能否覆盖已有文件。 如果文件可以覆盖,则值为 true ,否则为 false 。 如果忽略,则已有文件不能被覆盖。
unicode:可选项。 boolean 值,指明文件是否以 unicode 或 ascii 文件方式创建。 如果文件作为 unicode 文件创建,则值为 true ,如果作为 ascii 文件创建,则为 false。 如果忽略,则假定为 ascii 文件。
example: set fsocreatefile = fso.createtextfile(server.mappth(file),true,true)
PHP写文件倒很少乱码,但是经常会遇到BOM的问题
太不和谐。。可以选择编写一个独立的处理文件。
再次点击广告。
顶顶顶顶顶顶顶顶
◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。