title: Result in Node.JS Addon is different with Visual Studio
body: <p>I want to convert a wchar_t into a normal string. When I output the text in Visual Studio I get the correct text back. As soon as I do the same in my Node.JS addon, strange characters come back. Why is that so?</p>
  
  <pre class="lang-cpp prettyprint-override"><code>std::string ws_to_UTF8 (const wchar_t *ws)
  {
      std::wstring_convert &lt;std::codecvt_utf8 &lt;wchar_t&gt;, wchar_t&gt; convert;
      return convert.to_bytes (ws);
  }
  
  ...
  
  const int bufferSize = 1024;
  wchar_t textBuffer[bufferSize];
  int copied = SendMessage(hwndEdit, WM_GETTEXT, (WPARAM)bufferSize, (LPARAM)textBuffer);
  printf("Copied %d chars.\n", copied);
  printf("getting text:\n");
  
  printf("%s \n", ws_to_UTF8(textBuffer).c_str());
  
  // Output in Visual Studio (correct):Kein Papier / Kassette falsch eingesetzt!
  
  // Pr├╝fen Sie, ob das Papier richtig in das Papierfach eingelegt und ob das Papierfach richtig installiert ist.
  
  // Output in Node.JS
  // µòïµ╣®ÕÇáþüíµò®Ôü▓ÔÇ»µàïþì│þæÑµò┤µÿáµ▒íµì│Ôü¿µÑÑµØ«þìÑþæÑþæ║Ó┤íÓ┤èÕÇè´▒▓µòªÔü«µÑôÔ▒Ñµ╝áÔüóµàñÔü│µàÉµÑ░þëÑþêáµì®þæ¿µØ®µñáÔü«µàñÔü│µàÉµÑ░þëÑµàªµíúµöáµ╣®µòºµò¼þæºþöáµæ«µ╝áÔüóµàñÔü│µàÉµÑ░þëÑµàªµíúþêáµì®þæ¿µØ®µñáþì«µà┤µ▒¼µò®þæ▓µñáþæ│.þë»K
  </code></pre>