G
Guest
Hello,
I am trying to read the contents of 01.bin (unicode) into a String, to
modify it and finally to write it back into an other file named 02.bin.
If the file really contains "a b c", then everything is replaced properly.
But the finally output looks like "ÿþb b c".
There is that prefix ÿþ. I assume that it is always printed when you work
with unicode files but I do not know how to get rid of it.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim enc As System.Text.Encoding = System.Text.Encoding.Unicode
Dim a As String =
Microsoft.VisualBasic.FileIO.FileSystem.ReadAllText("01.bin", enc)
Dim b As String = Replace(a, "abc", "bbc", 1, -1)
Microsoft.VisualBasic.FileIO.FileSystem.WriteAllText("02.bin", b,
False, enc)
End Sub
I am trying to read the contents of 01.bin (unicode) into a String, to
modify it and finally to write it back into an other file named 02.bin.
If the file really contains "a b c", then everything is replaced properly.
But the finally output looks like "ÿþb b c".
There is that prefix ÿþ. I assume that it is always printed when you work
with unicode files but I do not know how to get rid of it.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim enc As System.Text.Encoding = System.Text.Encoding.Unicode
Dim a As String =
Microsoft.VisualBasic.FileIO.FileSystem.ReadAllText("01.bin", enc)
Dim b As String = Replace(a, "abc", "bbc", 1, -1)
Microsoft.VisualBasic.FileIO.FileSystem.WriteAllText("02.bin", b,
False, enc)
End Sub