Convert.ToBase64String & System.Text.Encoding.UTF8.GetString

  • Thread starter Thread starter Umut Tezduyar
  • Start date Start date
U

Umut Tezduyar

What are the differences between these two methods. When i should use which
?

Also i want to know:
I generate byte by using RNGCryptoServiceProvider.GetBytes ();
I wonder how can i convert it by using Convert.ToBase64String (), i mean
the bytes that are generated may be not A-Z, a-z, 0-9, +,- . It may be other
different characters. But Convert.ToBase64String () converts them as the
variations A-Z, a-z, 0-9, +,-
 
Base64 is a way of encoding binary data in 6 bits per character. It's used
when you'd have problems using 7-bit or plain binary (for instance, inside
an XML message). UTF8.GetString takes a byte array and converts it to a
string (Unicode) using the UTF-8 scheme.
-mike
MVP
 
Back
Top