How do I convert a byte
array to a char
array in C#?
System.Text.Encoding.ChooseYourEncoding.GetString(bytes).ToCharArray();
Substitute the right encoding above: e.g.
System.Text.Encoding.UTF8.GetString(bytes).ToCharArray();
You must know the source encoding.
string someText = "The quick brown fox jumps over the lazy dog."; byte[] bytes = Encoding.Unicode.GetBytes(someText); char[] chars = Encoding.Unicode.GetChars(bytes);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With