Decoder Class converts a sequence of encoded bytes into a set of characters. : Decoder « Development « VB.Net






Decoder Class converts a sequence of encoded bytes into a set of characters.

 

Imports System
Imports System.Text

Public Class dec

    Public Shared Sub Main()
        Dim bytes1 As Byte() =  {&H20, &H23, &HE2}
        Dim bytes2 As Byte() =  {&H98, &HA3}
        Dim chars(3) As Char

        Dim d As Decoder = Encoding.UTF8.GetDecoder()
        Dim charLen As Integer = d.GetChars(bytes1, 0, bytes1.Length, chars, 0)

        d.GetChars(bytes2, 0, bytes2.Length, chars, charLen)
        Dim c As Char
        For Each c In  chars
            Console.Write("U+{0:X4}  ", Convert.ToUInt16(c) )
        Next c
    End Sub
End Class

   
  








Related examples in the same category

1.Create Decoder class.
2.Decoder.GetCharCount calculates the number of characters produced by decoding a sequence of bytes
3.Decodes a sequence of bytes from the specified byte array