Mega Code Archive

 
Categories / C# / Internationalization
 

Gets an encoding for the UTF-32 format using the little endian byte order

using System; using System.Text; public class Example {    public static void Main()    {       Encoding enc = new UTF32Encoding(false, true, true);       string value = "\u00C4 \uD802\u0033 \u00AE";           byte[] bytes= enc.GetBytes(value);          foreach (var byt in bytes)             Console.Write("{0:X2} ", byt);          Console.WriteLine();          string value2 = enc.GetString(bytes);          Console.WriteLine(value2);    } }