代码如下:
QString profilePath = "在目录";
fprintf(stderr, "profilePath: %s\n", profilePath.toUtf8());
fprintf(stderr, "profilePath: %s\n", profilePath.toLocal8Bit().constData());
fprintf(stderr, "profilePath: %s\n", qPrintable(profilePath));
fprintf(stdout, "33 %s\n", profilePath.toStdString().c_str());
fflush(stdout);
fprintf(stderr, "55 %s\n", profilePath.toUtf8().data());
fprintf(stderr, "77 %s\n", profilePath.toLatin1().data());
QByteArray localMsg = profilePath.toLocal8Bit();
fprintf(stderr, "99 %s\n", localMsg.constData());
如果把
QString profilePath = "在目录";
修改为
QString profilePath = "你好";
就没有那个问题,具体原因不明
解决方法,请参考
https://blog.youkuaiyun.com/wowocpp/article/details/120483528