using System;
using System.Text;
string EncodeBase64(string code_type, string code)
{
string encode = "";
byte[] bytes = Encoding.GetEncoding(code_type).GetBytes(code);
try
{encode = Convert.ToBase64String(bytes);
}
catch
{encode = code;}
return encode;
}
EncodeBase64(“utf-8”, “abc123”);