Hi,

The following minimal code example demonstrates the issue (tested on Qt
5.6.1):

#include <QDebug>
#include <iostream>
#include <string>

int main(int, char **)
{
  qDebug() << "tr:" << QObject::tr("Co\u00F6rdinaat");
  qDebug() << "QString:" << QString("Co\u00F6rdinaat");
  qDebug() << "(QDebug) std::string:" <<
QString::fromStdString(std::string("Co\u00F6rdinaat"));
  std::cout << "(cout) std::string: " << std::string("Co\u00F6rdinaat") <<
std::endl;

  return 0;
}

Here all the qDebug lines output "Co?rdinaat". The cout line outputs
"Coördinaat" as i would expect.
If i use visual studio (both 2010 and 2015) for the above example, only the
std::cout gives the output i'd expect (which is "Coördinaat").
If i use mingw the exact opposite is the result. All qDebug lines output
"Coördinaat", but the cout line outputs as "Coördinaat"

QStringLiteral("Co\u00F6rdinaat") works on MSVC (2010 and 2015) as well as
MinGW. But for my case that fix isn't working because the string must be
within tr(...) and that function doesn't accept a QStringLiteral.

Is there any way that i can use a string with unicode code points within
tr(...) that works on MSVC 2010 (as that is my setup), but it would be
great if it also works under MSVC 2015 and MinGW.

Best regards,
Mark
_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to