fix: Maybe got an error text code on windows

This commit is contained in:
dreamsourcelabTAI 2023-01-30 14:48:33 +08:00
parent 2a1e1b464f
commit f2bc9ee72f

View File

@ -22,6 +22,8 @@
#include "path.h"
#ifdef _WIN32
#include <QTextCodec>
#include "../log.h"
#include <string.h>
#endif
namespace pv{
@ -47,9 +49,15 @@ namespace path{
std::string str;
#ifdef _WIN32
QTextCodec *codec = QTextCodec::codecForLocale();
QByteArray str_tmp = codec->fromUnicode(path);
str = str_tmp.data();
QTextCodec *codec = QTextCodec::codecForName("System");
if (codec != NULL){
QByteArray str_tmp = codec->fromUnicode(path);
str = str_tmp.data();
}
else{
dsv_err("Error: can't get \"System\" page code");
str = path.toUtf8().data();
}
#else
str = path.toUtf8().data();
#endif