forked from Ivasoft/DSView
fix: support unicode channel name
This commit is contained in:
@@ -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());
|
||||
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,8 @@ class QTextStream;
|
||||
|
||||
namespace pv{
|
||||
namespace encoding{
|
||||
|
||||
void init();
|
||||
|
||||
void set_utf8(QTextStream &stream);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user