Show warning if no available codec for code page when export in dxf.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2020-01-11 12:04:31 +02:00
parent 63c4725e81
commit 110aa16650

View File

@ -5,6 +5,8 @@
#include <QString>
#include <QTextCodec>
#include "../drw_base.h"
#include "../vmisc/vabstractapplication.h"
#include "../ifc/exception/vexception.h"
DRW_TextCodec::DRW_TextCodec()
: version(DRW::AC1021),
@ -69,6 +71,14 @@ void DRW_TextCodec::setCodePage(const std::string *c, bool dxfFormat){
conv = QTextCodec::codecForName("UTF-16");
}
}
if (conv == nullptr)
{
const QString errorMsg = QCoreApplication::translate("DRW_TextCodec", "No available codec for code page '%1'.")
.arg(cp.c_str());
qApp->IsPedantic() ? throw VException(errorMsg) :
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
}
}
std::string DRW_TextCodec::toUtf8(const std::string &s) {