Write the UTF-16 encoded bytes of the source string : Encoding UTF16 : I18N Internationalization C# Examples


C# Examples » I18N Internationalization » Encoding UTF16 »

 

Write the UTF-16 encoded bytes of the source string









    
using  System;
using  System.IO;
using  System.Text;

class  MainClass
{
        public  static  void  Main()  
        {                
                using  (StreamWriter  output  =  new  StreamWriter("output.txt"))  
                {
                        string  srcString  =  "Area  =  \u03A0r^2";
                        byte[]  utf16String  =  Encoding.Unicode.GetBytes(srcString);
                        output.WriteLine("UTF-16  Bytes:  {0}",  BitConverter.ToString(utf16String));
                }
        }
}
    
   
  
   




HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo I18N Internationalization
» Encoding UTF16