2
0
forked from Ivasoft/DSView

fix: support unicode channel name

This commit is contained in:
dreamsourcelabTAI
2022-08-19 19:46:39 +08:00
parent ef4132e2a7
commit dcb195404d
3 changed files with 18 additions and 3 deletions

View File

@@ -34,6 +34,7 @@
#include "config/appconfig.h"
#include "log.h"
#include "utility/path.h"
#include "utility/encoding.h"
AppControl::AppControl()
{
@@ -70,6 +71,8 @@ void AppControl::Destroy(){
bool AppControl::Init()
{
pv::encoding::init();
sr_log_set_context(dsv_log_context());
srd_log_set_context(dsv_log_context());

View File

@@ -28,17 +28,27 @@
#include <QTextCodec>
#endif
#ifdef _WIN32
#include <QTextCodec>
#endif
namespace pv{
namespace encoding{
void init()
{
#ifdef _WIN32
QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8"));
#endif
}
void set_utf8(QTextStream &stream)
{
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
stream.setEncoding(QStringConverter::Utf8);
#else
//QTextCodec *code = QTextCodec::codecForName("UTF-8");
// stream.setCodec(code);
stream.setCodec("UTF-8");
QTextCodec *code = QTextCodec::codecForName("UTF-8");
stream.setCodec(code);
#endif
}
}

View File

@@ -26,6 +26,8 @@ class QTextStream;
namespace pv{
namespace encoding{
void init();
void set_utf8(QTextStream &stream);
}