From my database I am getting a very long string which is basically xml. I need to change it to a byte array.
I can't get my head around the potential encoding issues.
What do I need to be careful of when doing this conversion?
public static byte[] StringToByteArray1(string str)
{
return Encoding.ASCII.GetBytes(str);
}
public static byte[] StringToByteArray2(string str)
{
return Encoding.UTF8.GetBytes(str);
}
Encoding.ASCII.GetBytes vs Encoding.UTF8.GetBytes