D
Dan
I have the following code section that I thought would strip out all the
non-ascii characters from a string after decoding it. Unfortunately the
non-ascii characters are still in the string.
What am I doing wrong?
Dim plainText As String
plainText = "tâ•e"
Dim plainTextBytes() As Byte
Dim enc As Encoding = Encoding.ASCII
plainTextBytes = enc.GetBytes(plainText)
Dim str As String
str = enc.GetString(plainTextBytes).ToString
MessageBox.Show("before " & str)
Dim decodeString As String = enc.GetString(plainTextBytes)
MessageBox.Show("after " & decodeString)
Any help would be greatly appreciated.
Dan
non-ascii characters from a string after decoding it. Unfortunately the
non-ascii characters are still in the string.
What am I doing wrong?
Dim plainText As String
plainText = "tâ•e"
Dim plainTextBytes() As Byte
Dim enc As Encoding = Encoding.ASCII
plainTextBytes = enc.GetBytes(plainText)
Dim str As String
str = enc.GetString(plainTextBytes).ToString
MessageBox.Show("before " & str)
Dim decodeString As String = enc.GetString(plainTextBytes)
MessageBox.Show("after " & decodeString)
Any help would be greatly appreciated.
Dan