What is proper encoding for converting a string to a byte array?

Thank you very much! This works now. I simply eliminated the enum and the function I wrote called StringToByteArray.

Instead I coded the following: byte binData = Convert. FromBase64String(fileContent); Case closed. You were a huge help....(seems like a very big subject).

– John Galt Aug 3 '09 at 20:38.

Base64 is an encoding scheme that enables you to represent binary data as a series of ASCII characters so that it can be included in text files and e-mail messages in which raw binary data is unacceptable. The below examples show encoding and decoding of unicode strings. Let me know if this is what you wanted,if not I can refind this further for you.

//Encoding public static string StringToBase64 (string src) { // Get's byte representation unicode string byte be = Encoding.Unicode. GetBytes(src); // Returns Base64-encoded string return Convert. ToBase64String(b); } //Decoding public static string Base64ToString (string src) { // Decodes Base64-encoded string to a byte array byte be = Convert.

FromBase64String(src); // Returns decoded Unicode string return Encoding.Unicode. GetString(b); }.

I think he just wants the byte array- string isn't the final goal. – Joel Coehoorn Aug 3 '09 at 19:15 Yes...I want a byte array, not a string. Also, please see my EDIT update of the original post.Thanks...I am still groping.. – John Galt Aug 3 '09 at 20:14 I wonder if my use of my StringToByteArray function is wrong.

When I pick up the data out of Request. Form, I first put it into a string. Perhaps that is incorrect?

– John Galt Aug 3 '09 at 20:19.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions