title: Outputting UTF-8 with qInstallMsgHandler
body: <p>I would like to make my debug handler (installed with <code>qInstallMsgHandler</code>) handles UTF-8, however it seems it can only be defined as <code>void myMessageOutput(QtMsgType type, const char *msg)</code> and <code>const char*</code> doesn't handle UTF-8 (once displayed, it's just random characters).</p>
  
  <p>Is there some way to define this function as <code>void myMessageOutput(QtMsgType type, QString msg)</code>, or maybe some other way to make it work?</p>
  
  <p>This is my current code:</p>
  
  <pre><code>void myMessageOutput(QtMsgType type, const char *msg) {
      QString message = "";
  
      QString test = QString::fromUtf8(msg);
  
      // If I break into the debugger here. both "test" and "msg" contain a question mark.
  
      switch (type) {
  
          case QtDebugMsg:
          message = QString("[Debug] %1").arg(msg);
          break;
  
          case QtWarningMsg:
          message = QString("[Warning] %1").arg(msg);
          break;
  
          case QtCriticalMsg:
          message = QString("[Critical] %1").arg(msg);
          break;
  
          case QtFatalMsg:
          message = QString("[Fatal] %1").arg(msg);
          abort();
  
      }
  
      Application::instance()-&gt;debugDialog()-&gt;displayMessage(message);
  }
  
  
  
  Application::Application(int argc, char *argv[]) : QApplication(argc, argv) {
      debugDialog_ = new DebugDialog();
      debugDialog_-&gt;show();
  
      qInstallMsgHandler(myMessageOutput);
  
      qDebug() &lt;&lt; QString::fromUtf8("我");
  }
  </code></pre>