ASP code for generating UTF-8 code

Source: Internet
Author: User

Method 1: createtextfile file generation 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 2: file generation using ADODB. Stream
Set ccobjstream = server. Createobject ("ADODB. Stream ")
With ccobjstream
. Type = 2
. Mode = 3
. Open
. Charset = "UTF-8"
. Position = ccobjstream. Size
. Writetext
. Savetofile to generate the file path and file name, 2
. Close
End

Createtextfile Method
Creates a specified file and returns a textstream object. This object can be used to read or write the created file.

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

Parameters
Object

Required. The name of the FileSystemObject or folder object.

Filename

Required. String expression, indicating the file to be created.

Overwrite

Optional. Boolean indicates whether existing files can be overwritten. If the file can be overwritten, the value is true. If the file cannot be overwritten, the value is false. If this value is omitted, the existing file cannot be overwritten.

Unicode

Optional. Boolean indicates whether to create a file in Unicode or ASCII format. If a file is created in unicode format, the value is true. If a file is created in ASCII format, the value is false. If this part is omitted, an ASCII file is 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.