using System;
using System.Text;
class ExampleEncodageUTF8
{
public static void Main()
{
String chaine = "Exemple Encodage sur mesexemples.com";
UTF8Encoding utf8 = new UTF8Encoding();
int nombreOctets = utf8.GetByteCount(chaine.ToCharArray(), 0, chaine.Length);
Byte[] octets = new Byte[nombreOctets];
int encodageCar = utf8.GetBytes(chaine, 0, chaine.Length, octets, 0);
Console.WriteLine(encodageCar);
foreach (Byte b in octets)
{
Console.Write("[{0}]", b);
}
}
}