Decodes a sequence of bytes from the specified byte array into the specified character array. : UTF8Encoding « Internationalization I18N « VB.Net






Decodes a sequence of bytes from the specified byte array into the specified character array.

 

Imports System
Imports System.Text

Class UTF8EncodingExample

    Public Shared Sub Main()
        Dim chars() As Char
        Dim bytes() As Byte = { _
            85,  84,  70,  56,  32,  69, 110, _
            69, 120,  97, 109, 112, 108, 101 _
        }

        Dim utf8 As New UTF8Encoding()

        Dim charCount As Integer = utf8.GetCharCount(bytes, 2, 13)
        chars = New Char(charCount - 1) {}
        Dim charsDecodedCount As Integer = utf8.GetChars(bytes, 2, 13, 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.Obtains a decoder that converts a UTF-8 encoded sequence of bytes into a sequence of Unicode characters.
3.Encoding.UTF8
4.UTF-8 encoding of Unicode characters.
5.Create UTF8Encoding class
6.Create UTF8Encoding class.
7.UTF8Encoding.Equals