Function BuildFile(ByVal sFile, ByVal sContent) On Error Resume Next Dim oFSO, oStream ' Response.Write sFile ' Response.Write sContent ' Response.end If CacheConfig(24) = "1" Then '如果选用ADODB.Steam 则强制转换成Unicode If Right(LCase(sFile),4) <> ".xml" Then sContent = AnsiToUnicode(sContent) End if Set oStream = Server.CreateObject(CacheCompont(2)) With oStream .Type = 2 .Mode = 3 .open '.Charset = "utf-8" .Charset = "gb2312" .Position = oStream.size .WriteText = sContent .SaveToFile sFile, 2 .Close End With Set oStream = Nothing Else Set oFSO = Server.CreateObject(CacheCompont(1)) Set oStream = oFSO.CreateTextFile(sFile,True) oStream.Write sContent oStream.Close '增加对特殊字符的保护,强制将内容转换成Unicode If Err.Number<>0 Then sContent = AnsiToUnicode(sContent) Set oStream = Server.CreateObject(CacheCompont(2)) With oStream .Type = 2 .Mode = 3 .open '.Charset = "utf-8" .Charset = "gb2312" .Position = oStream.size .WriteText = sContent .SaveToFile sFile, 2 .Close End With Err.Clear End If Set oStream = Nothing Set oFSO = Nothing End If End Function