CharArrayToString(buffer, 0, -1, 1200); does not copy unicoded std::wstring myString from C++ DLL into MT5 string properly

 

The uchar buffer array contents in MT5 is shown below:

Unicoded Buffer contents

Message from DLL (len=19) in C++ reads:

std::wstring myString = L"Hello from C++ DLL!\0\0";

The uchar array contents is correct for the Unicoded text with '0' as part of each UTF-16 character.

But MQL5 code

string receivedString = CharArrayToString(buffer, 0, -1, 1200);

MQL5 converts the incoming uchar buffer filled by the DLL to the following receivedString:  "" (length: 0).

Apparently, CharArrayToString() is not using the UTF-16 (1200) code page properly.

What is happening? How do I convert incoming Unicoded sting from C++ DLL in uchar array to a MT% string variable properly?