Details
-
Bug
-
Resolution: Out of scope
-
P3: Somewhat important
-
4.6.0, 5.9.1
-
Windows XP
Description
Write a code that will check to see if it can convert a UTF16 string into MultiByte in the current locale is not possible.
QTextCodec::canEncode() always succeeds because:
This code:
QByteArray QWindowsLocalCodec::convertFromUnicode(const QChar *uc, int len, ConverterState *) const { return qt_winQString2MB(uc, len); }
does not use the converter state's 'invalidChars' param to be set to true if characters are replaced.
Edit: Testcase:
assert(!QTextCodec::codecForName("ASCII")->canEncode(QString::fromUtf8("t\xC3\xB6")));
It should be false since "tö" is encoded as "t?" with that codec.