Base64 encode a Unicode string as a string : Encoding Based64 : I18N Internationalization C# Examples


C# Examples » I18N Internationalization » Encoding Based64 »

 

Base64 encode a Unicode string as a string









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

class  MainClass
{
        public  static  void  Main()  
        {

                byte[]  b  =  Encoding.Unicode.GetBytes("string");

                //  Return  the  Base64-encoded  string.
                string  str  =    Convert.ToBase64String(b);
                Console.WriteLine(str);

                Convert.FromBase64String(str);

                //  Return  the  decoded  Unicode  string.
                Console.WriteLine(Encoding.Unicode.GetString(b));


        }
}
    
   
  
   



Output

cwB0AHIAaQBuAGcA
string


HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo I18N Internationalization
» Encoding Based64