FileSystemObject, can ADODB. Stream manipulate files in UTF-8 format?

Source: Internet
Author: User

Scripting. FileSystemObject:
FileSystemObject. createtextfile (filename [, overwrite [, Unicode])

The Unicode attribute is as follows:
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.

We cannot use this function to create UTF-8 format files.
At this time, we can use the ADODB. Stream object. The usage is as follows:
Set objstream = server. Createobject ("ADODB. Stream ")
With objstream
. Open
. Charset = "UTF-8"
. Position = objstream. Size
. Writetext = Str
. Savetofile server. mappath ("/sitemap. xml"), 2
. Close
End
Set objstream = nothing

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.