Mega Code Archive

 
Categories / VB.Net / Internationalization
 

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