im chinese,so where i use qDebug() found a issue.qDebug() can't not output a chinese character in Winxp.
i follow this bug in qcoreapplication_win.cpp in corelib folder function qWinMsgHandler
Q_CORE_EXPORT void qWinMsgHandler(QtMsgType t, const char* str)
{
Q_UNUSED(t);
// OutputDebugString is not threadsafe.
// cannot use QMutex here, because qWarning()s in the QMutex
// implementation may cause this function to recurse
static QWinMsgHandlerCriticalSection staticCriticalSection;
if (!str)
str = "(null)";
staticCriticalSection.lock();
QT_WA({
OutputDebugStringW((TCHAR*)s.utf16());
}, {
s += "\n";
OutputDebugStringA(s.data());
})
staticCriticalSection.unlock();
}
Q_CORE_EXPORT void qWinMsgHandler(QtMsgType t, const char* str)
{
Q_UNUSED(t);
// OutputDebugString is not threadsafe.
// cannot use QMutex here, because qWarning()s in the QMutex
// implementation may cause this function to recurse
static QWinMsgHandlerCriticalSection staticCriticalSection;
if (!str)
str = "(null)";
staticCriticalSection.lock();
QT_WA({
QString s(QString::fromLatin1(str));
s += QLatin1String("\n");
OutputDebugStringW((TCHAR*)s.utf16());
}, {
QByteArray s(str);
s += "\n";
OutputDebugStringA(s.data());
})
staticCriticalSection.unlock();
}
To copy to clipboard, switch view to plain text mode
bug in QString s(QString::fromLatin1(str)); if str is a gb18030 codec.then will get a error code
Bookmarks