Represents a UTF-32 encoding of Unicode characters.
Imports System Imports System.Text Imports Microsoft.VisualBasic Public Class SamplesUTF32Encoding Public Shared Sub Main() Dim u32LE As New UTF32Encoding(False, True) Dim u32withED As New UTF32Encoding(True, True, True) Dim u32noED As New UTF32Encoding(True, True, False) Dim myStr As String = ChrW(&H0306) & ChrW(&H01FD) Dim myBytes(u32LE.GetByteCount(myStr)) As Byte u32LE.GetBytes(myStr, 0, myStr.Length, myBytes, 0) PrintDecodedString(myBytes, u32withED) PrintDecodedString(myBytes, u32noED) End Sub 'Main Public Shared Sub PrintDecodedString(bytes() As Byte, enc As Encoding) Try Console.WriteLine(" Decoded string: {0}", enc.GetString(bytes, 0, bytes.Length)) Catch e As System.ArgumentException Console.WriteLine(e.ToString()) End Try End Sub End Class