Hi,

I was looking at how QString::toLocal8bit works and, on Windows, it looks like 
it may enter an infinite loop.

If I got it right, QString::toLocal8Bit_helper calls QTextCodec::fromUnicode 
which, on Windows, calls QWindowsLocalCodec::convertFromUnicode in 
qwindowscodec.cpp.

In that function, if WideCharToMultiByte fails because the input string is not 
a valid unicode string, the function displays a qWarning where it helpfully 
output the offending string using QString::toLocal8bit!

If the string cannot be converted in the first place, it won't be possible to 
convert it a second time to display the warning message. Hence the infinite 
loop.

It looks to me like the string should be displayed using QString::toUtf8.

Am I right? Is it worth opening a QTBUG for this?

Frederic

_______________________________________________
Development mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/development

Reply via email to