Answer the question
In order to leave comments, you need to log in
I can't convert characters to byte, how to make it work?
There is a code that converts string to byte:
byte[] data = Encoding.Unicode.GetBytes(message);
And that decrypts:
int bytes = 0; // количество полученных байтов
byte[] data = new byte[256]; // буфер для получаемых данных
do
{
bytes = handler.Receive(data);
builder.Append(Encoding.Unicode.GetString(data, 0, bytes));
}
while (handler.Available > 0);
Answer the question
In order to leave comments, you need to log in
var str = "test12!#@<смайлик>";
var utf16bytes = Encoding.Unicode.GetBytes(str);
var utf16reversed = Encoding.Unicode.GetString(utf16bytes); #test12!#@<смайлик>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question