JosP
asked on
writing the degree symbol to a text file
Hi,
I'm tring to write a string to a plain text file. The string contains ASCII code 176, the degree symbol. In the text file it is written as ° (capital A circumflex accent and then the degree symbol).
How can I just write the degree symbol? I suspect it has something to do with character sets?
TIA,
JosP
I'm tring to write a string to a plain text file. The string contains ASCII code 176, the degree symbol. In the text file it is written as ° (capital A circumflex accent and then the degree symbol).
How can I just write the degree symbol? I suspect it has something to do with character sets?
TIA,
JosP
If you are using StreamWriter then you can specify encoding. Something like "iso-8859-1" should work for usual plain text.
You can write it out specifying Unicode encoding. Here's an example:
Dim character As Char = Chr(176)
Dim path As String = "c:\temp\test.out"
Dim sw As New StreamWriter(path, False, System.Text.Encoding.Unico de)
sw.WriteLine(character)
sw.Close()
MsgBox("Done")
Dim character As Char = Chr(176)
Dim path As String = "c:\temp\test.out"
Dim sw As New StreamWriter(path, False, System.Text.Encoding.Unico
sw.WriteLine(character)
sw.Close()
MsgBox("Done")
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.