Mime encode string

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to mime encode a string. I think that mime is base64 coding (is this
true?).

I created the following code:

Dim oEncoder As New System.Text.ASCIIEncoding
Dim Str As String = "SYSTEM"
Dim bytes As Byte() = oEncoder.GetBytes(Str)
Convert.ToBase64String(bytes, 0, bytes.Length)
MsgBox(Encoding.ASCII.GetString(bytes)

But the MsgBox still shows up with the string SYSTEM. I know that the encode
string should be U1lTVEVN

What am I doing wrong?
 
Found it:

Dim Str As String = "SYSTEM"
Dim bytvalue() As Byte
bytvalue = Encoding.UTF8.GetBytes(Str.ToCharArray)
MsgBox(Convert.ToBase64String(bytvalue))
 
Back
Top