Mime encode string

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?
 
G

Guest

Found it:

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top