How to create a file of ANSI type

Your code looks almost the same as the documentation example.
Nothing jumps out.

How do you check that the result is UTF8?

Try writing the text to a binarystream instead - does that get the same issue?

[code]Dim FileName As String
Dim FinalString As String
FileName = “C:\TEMP\500” + “.sql”

Dim stream As BinaryStream
Dim f As FolderItem = New FolderItem(fileName,FolderItem.PathTypeAbsolute)
If f <> Nil Then
stream = BinaryStream.Create(f, True) // Overwrite if exists
stream.Write(ConvertEncoding(TextArea2.text, Encodings.WindowsANSI))
stream.Close
End If[/code]

1 Like