ASP generates UTF-8 code-application Tips

Source: Internet
Author: User
Method One: CreateTextFile generate File method

function WriteToFile (filename,filecontent)
Set Fso=server.createobject ("Scripting.FileSystemObject")
Set Fp=fso.createtextfile (Server.MapPath (FileName), True)
Fp.write (filecontent)
End Function

Method Two: ADODB.stream Generation file method
Set Ccobjstream = Server.CreateObject ("ADODB. Stream ")
With Ccobjstream
. Type = 2
. Mode = 3
. Open
. Charset = "Utf-8"
. Position = Ccobjstream.size
. WRITETEXT What to build
. SaveToFile to generate file paths and file names, 2
. Close
End With

CreateTextFile method
Creates a specified file and returns a TextStream object that can be used to read or write the created file.

Object. CreateTextFile (filename[, overwrite[, Unicode])

Parameters
Object

Required option. Should be the name of the FileSystemObject or Folder object.

FileName

Required option. A string expression that indicates the file to create.

Overwrite

Options available. A Boolean value that indicates whether an existing file can be overwritten. True if the file can be overwritten, or False if the file cannot be overwritten. If this value is omitted, the existing file cannot be overwritten.

Unicode

Options available. A Boolean value that indicates whether the file is created in Unicode or ASCII file format. True If the file is created in a Unicode file format, False if the file is created in an ASCII file format. If this section is omitted, the ASCII file is assumed to be created.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.