Jak zapsat v ASP string do souboru v UTF-8
Zde je VBScript (ASP) funkce pro zápis obsahu proměnné typu string do souboru s kódováním UTF-8:
Sub file_put_content( fileName , Text)
Const adTypeText = 2
Const adSaveCreateOverWrite = 2
'Create Stream object
Dim BinaryStream
Set BinaryStream = CreateObject("ADODB.Stream")
'Specify stream type - we want To save text/string data.
BinaryStream.Type = adTypeText
CharSet = "utf-8"
'Specify charset For the source text (unicode) data.
If Len(CharSet) > 0 Then
BinaryStream.CharSet = CharSet
End If
'Open the stream And write binary data To the object
BinaryStream.Open
BinaryStream.WriteText Text
'Save binary data To disk
BinaryStream.SaveToFile filename, adSaveCreateOverWrite
End Sub
Napsat komentář