Mega Code Archive

 
Categories / C# / Internationalization
 

Gets an encoding for the UTF-16 format that uses the big endian byte order

using System; using System.Text; public class Example {    public static void Main()    {       byte[] bytes = { 0x00, 0x20, 0xd8, 0x01, 0x00, 0x68, 0xA7, 0x00 };       Encoding enc = new UnicodeEncoding(true, true, true);          string value = enc.GetString(bytes);          Console.WriteLine();          Console.WriteLine("'{0}'", value);    } }