title: Get Strings in right encoding in c++
body: <p>I asked a similar question before.
  But I am still in trouble with encodings in c++.
  I try to describe the problem as well as possible.</p>
  
  <p>I have a c++ client, communicating with an c# service over TCP.
  Now I need to display the Messages from the service in an Messagebox (Win32 API).
  The Bytes, sended by the c# service are UTF-8 encoded.</p>
  
  <p>Important to know, the c++ client will only be running on Windows Systems.</p>
  
  <p>This is the code to receive the bytes and to display the Text:</p>
  
  <pre><code>    char buffer[1024];
      int receivedBytes = recv(socketHandle, buffer, sizeof(buffer) - 1, 0);
      char str[receivedBytes];
      for (int index = 0; index &lt; receivedBytes; index++)
      {
          str[index] = buffer[index];
      }
  
      MessageBox(mainWindow, (LPCTSTR)str, (LPCTSTR) "Fehler", MB_OK|MB_ICONERROR);
  </code></pre>
  
  <p>If the Text contains chatacters like üäö, they are not shown in the Messagebox the correct way.
  What can I do to receive the message as UTF-8 String in c++?
  Is there a possibility to convert the char[] to an UTF-8 String?</p>
  
  <p>Thx for helping</p>
  
  <p>Tobi</p>