Encodage d’un jeux de caractère

Author:

énumérer,toutes,les,cultures,disponibles
{filelink=19565}

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);
        }
    }
}

Leave a Reply

Your email address will not be published. Required fields are marked *