Our current process is create a txt file, and then write into data save as a XML file. Target application read this xml file for further process.
I am using codes to create a txt file, the file is defaulted to UTF-8, in fact I have no idea why it is defaulted to that. below is my codes.
Try
Dim sw As StreamWriter
If File.Exists(File_Name) = False Then
sw = File.CreateText(File_Name)
End If
Success = True
Message = ""
Catch e As Exception
Success = False
Message = e.Message
End Try
But recently the target application get upgraded, the acceptable encoding is ANSI instead of UTF-8 any more, else Chinese characters will be not recognized.
I am thinking to create a txt object to change the encoding, but it looks inefficient. I want to know how to create the txt file with ANSI encoding based on my codes.