Nicksop,
Remember that when you read a file into a string it is converted from the
encoding in the file to Unicode, that when you write it is converted from
Unicode to the encoding in the file.
You can use System.Text.Encoding.Default to get the current Windows ANSI
Code page encoding object. You can use System.Text.Encoding.GetEncoding to
get a specific code page (such as an OEM one).
You can use the
System.Globalization.CultureInfo.CurrentCulture.TextInfo.OEMCodePage to get
the current OEM code page.
Dim input As New StreamReader(inputPath, Encoding.Default)
Dim output As New StreamWriter(outputPath, False,
Encoding.GetEncoding(CultureInfo.CurrentCulture.TextInfo.OEMCodePage))
Dim line As String
line = input.ReadLine()
Do Until line Is Nothing
output.WriteLine(line)
line = input.ReadLine()
Loop
input.Close()
output.Close()
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.