How should I modify the following Vb.Net code to write str
to the file in unicode?
Do I need to convert str
to Unicode before writing to the file?
Using sw As StreamWriter = New StreamWriter(fname)
sw.Write(str)
sw.Close()
End Using
Use the overriden constructor to specify the encoding
Using sw As StreamWriter = New StreamWriter(fname, true, System.Text.Encoding.Unicode)
sw.Write(str)
sw.Close()
End Using
Pick either UTF8(8bit) or Unicode(16 bit) character-set encoding as per your requirements.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With