UTF-7 encoding of Unicode characters. : UTF7Encoding « Internationalization I18N « C# / C Sharp






UTF-7 encoding of Unicode characters.

 

using System;
using System.Text;

class UTF7EncodingExample {
    public static void Main() {
        UTF7Encoding utf7 = new UTF7Encoding();

        String unicodeString ="Pi (\u03a0) and Sigma (\u03a3).";

        Byte[] encodedBytes = utf7.GetBytes(unicodeString);
        foreach (Byte b in encodedBytes) {
            Console.Write("[{0}]", b);
        }
        String decodedString = utf7.GetString(encodedBytes);
        Console.WriteLine(decodedString);
    }
}

   
  








Related examples in the same category