1

I was translating some C++ code to C# and I saw the below function

myMultiByteToWideChar( encryptedBufUnicode, (char*)encryptedBuf, sizeof(encryptedBufUnicode) );

This basically converts the char array to unicode.

In C#, aren't strings and char arrays already unicode? Or do we need to make it unicode using a system.text function?

0

1 Answer 1

2

C# strings and characters are UTF-16.

If you have an array of bytes, you can use the Encoding class to read it as a string using a correct encoding.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.