Encoding\Encoding.ASCII Property gets an encoding for the ASCII (7-bit) character set.
Imports System.Text
Module Example
Public Sub Main()
Dim enc As Encoding = Encoding.GetEncoding("us-ascii",
New EncoderExceptionFallback(),
New DecoderExceptionFallback())
Dim value As String = ChrW(&HC4) & ChrW(&HF6) & ChrW(&HAE)
Dim bytes() As Byte = enc.GetBytes("this is a test")
For Each byt As Byte In bytes
Console.Write("{0:X2} ", byt)
Next
Dim value2 As String = enc.GetString(bytes)
Console.WriteLine(value2)
End Sub
End Module
Related examples in the same category