Hi,
I need clarification on how can I do encoding on my string to meet Decoding in Java for ToBase64 and UTF8 decoding.
I am doing the following logic, but even then the characters are showing junk. I am using this for Japanese characters (Max UTF 8)
/*********************************
byte[] lArrByte = ASCIIEncoding.UTF8.GetBytes(strInputMsg.ToCharArray());
string lSTrBase64String = Convert.ToBase64String(lArrByte);
queueMessage.WriteBytes(lSTrBase64String);
queueMessage.CharacterSet = lSTrBase64String.Length;
queueMessage.Format = MQC.MQFMT_IMS_VAR_STRING;
queuePutMessageOptions = new MQPutMessageOptions();
queue.Put(queueMessage, queuePutMessageOptions);
queueManager.Commit();
/*********************************
Any Suggestions on this please.
Thanks
Sreenath.
Guest UserPosted Apr 6, 2011, 9:49 AM
byte[] lArrByte = ASCIIEncoding.UTF8.GetBytes(@"Hello World".ToCharArray());
string lSTrBase64String = Convert.ToBase64String(lArrByte);
Debug.WriteLine(lSTrBase64String);
I get this:
SGVsbG8gV29ybGQ=
which is what I would expect.
Are you sure Base64 encoding is a requirement? You should review this page which is a good overwiew:
http://www.devtoolsonline.com/content/general-purpose/base64-encode-decode/base64-encode-decode.html