Obtains a decoder that converts a UTF-8 encoded sequence of bytes into a sequence of Unicode characters. : UTF8Encoding « Internationalization I18N « VB.Net






Obtains a decoder that converts a UTF-8 encoded sequence of bytes into a sequence of Unicode characters.

 

Imports System
Imports System.Text

Class UTF8EncodingExample

    Public Shared Sub Main()
        Dim chars() As Char
        Dim bytes() As Byte = {99, 204, 128, 234, 130, 160}

        Dim utf8Decoder As Decoder = Encoding.UTF8.GetDecoder()

        Dim charCount As Integer = utf8Decoder.GetCharCount(bytes, 0, bytes.Length)
        chars = New Char(charCount - 1) {}
        Dim charsDecodedCount As Integer = utf8Decoder.GetChars(bytes, 0, bytes.Length, chars, 0)

        Dim c As Char
        For Each c In  chars
            Console.Write("[{0}]", c)
        Next c
    End Sub 
End Class

   
  








Related examples in the same category

1.Calculates number of characters produced by decoding a sequence of bytes from the specified byte array.
2.Decodes a sequence of bytes from the specified byte array into the specified character array.
3.Encoding.UTF8
4.UTF-8 encoding of Unicode characters.
5.Create UTF8Encoding class
6.Create UTF8Encoding class.
7.UTF8Encoding.Equals