Unicode enconding demonstration. - CSharp Language Basics

CSharp examples for Language Basics:string

Description

Unicode enconding demonstration.

Demo Code

using System;//  w w  w  .j av  a2s.  co m
public class MainClass
{
   public static void Main(string[] args)
   {
      // English
      char[] english = { '\u0057', '\u0065', '\u006C',
      '\u0063', '\u006F', '\u006D', '\u0065', '\u0020',
      '\u0074', '\u006F', '\u0020' };
      new string(english);
      Console.WriteLine(english);
      // French
      char[] french = { '\u0042', '\u0069', '\u0065',
      '\u006E', '\u0076', '\u0065', '\u006E', '\u0075',
      '\u0065', '\u0020', '\u0061', '\u0075', '\u0020' };
      new string(french);
      // German
      char[] german = { '\u0057', '\u0069', '\u006C',
      '\u006B', '\u006F', '\u006D', '\u006D', '\u0065',
      '\u006E', '\u0020', '\u007A', '\u0075', '\u0020' };
      new string(german);
      // Japanese
      char[] japanese = { '\u3078',  '\u3087', '\u3045',
      '\u3053', '\u305D', '\u0021' };
      new string(japanese);
      // Portuguese
      char[] portuguese = { '\u0053', '\u0065', '\u006A',
      '\u0061', '\u0020', '\u0062', '\u0065', '\u006D',
      '\u0020', '\u0076', '\u0069', '\u006E', '\u0064',
      '\u006F', '\u0020', '\u0061', '\u0020' };
      new string(portuguese);
      // Russian
      char[] russian = { '\u0414', '\u043E', '\u0431',
      '\u0440', '\u043E', '\u0020', '\u043F', '\u043E',
      '\u0436', '\u0430', '\u043B', '\u043E', '\u0432',
      '\u0430', '\u0442', '\u044A', '\u0020', '\u0432', '\u0020' };
      new string(russian);
      // Spanish
      char[] spanish = { '\u0042', '\u0069', '\u0065',
      '\u006E', '\u0076', '\u0065', '\u006E', '\u0069',
      '\u0064', '\u006F', '\u0020', '\u0061', '\u0020' };
      new string(spanish);
      // Simplified Chinese
      char[] chinese = { '\u6B22', '\u8FCE', '\u4F7F',
      '\u7528', '\u0020' };
      new string(chinese);
   }
}

Result


Related Tutorials