Gets an encoding for the UTF-8 format.
using System;
using System.Text;
public class Example
{
public static void Main()
{
Encoding enc = new UTF8Encoding(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);
}
}
Related examples in the same category