如果你在寫 ASP 或 VB 且一定要將文字儲存成 UTF-8 編碼,這個 Function 應該可以幫你的忙:
Function SaveTextAsUTF8(filePath, Text)
Const adTypeText = 2
Const adSaveCreateOverWrite = 2
'Create Stream object
Dim TextStream
Set TextStream = CreateObject("ADODB.Stream")
With TextStream
.Open
.CharSet = "UTF-8"
.Position = TextStream.Size
.WriteText Text
.SaveToFile filePath, adSaveCreateOverWrite
.Close
End With
Set TextStream = Nothing
End Function