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(pl ainText)
Dim str As String
str = enc.GetString(p lainTextBytes). ToString
MessageBox.Show ("before " & str)
Dim decodeString As String = enc.GetString(p lainTextBytes)
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(pl ainText)
Dim str As String
str = enc.GetString(p lainTextBytes). ToString
MessageBox.Show ("before " & str)
Dim decodeString As String = enc.GetString(p lainTextBytes)
MessageBox.Show ("after " & decodeString)
Any help would be greatly appreciated.
Dan
Comment