mirror of
https://github.com/JakubMelka/PDF4QT.git
synced 2025-06-05 21:59:17 +02:00
Issue #25: Windows build without plugins
This commit is contained in:
@@ -19,7 +19,7 @@
|
||||
#include "pdfdbgheap.h"
|
||||
|
||||
#include <QTimeZone>
|
||||
#include <QTextCodec>
|
||||
#include <QStringDecoder>
|
||||
|
||||
#include <cctype>
|
||||
#include <cstring>
|
||||
@@ -2373,21 +2373,21 @@ QString PDFEncoding::convertSmartFromByteStringToUnicode(const QByteArray& strea
|
||||
|
||||
if (hasUnicodeLeadMarkings(stream))
|
||||
{
|
||||
QTextCodec::ConverterState state = { };
|
||||
|
||||
{
|
||||
QTextCodec* codec = QTextCodec::codecForName("UTF-16BE");
|
||||
QString text = codec->toUnicode(stream.constData(), stream.length(), &state);
|
||||
if (state.invalidChars == 0)
|
||||
QStringDecoder decoder(QStringDecoder::Utf16BE);
|
||||
QString text = decoder.decode(stream);
|
||||
|
||||
if (!decoder.hasError())
|
||||
{
|
||||
return text;
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
QTextCodec* codec = QTextCodec::codecForName("UTF-16LE");
|
||||
QString text = codec->toUnicode(stream.constData(), stream.length(), &state);
|
||||
if (state.invalidChars == 0)
|
||||
QStringDecoder decoder(QStringDecoder::Utf16LE);
|
||||
QString text = decoder.decode(stream);
|
||||
|
||||
if (!decoder.hasError())
|
||||
{
|
||||
return text;
|
||||
}
|
||||
@@ -2396,11 +2396,10 @@ QString PDFEncoding::convertSmartFromByteStringToUnicode(const QByteArray& strea
|
||||
|
||||
if (hasUTF8LeadMarkings(stream))
|
||||
{
|
||||
QTextCodec::ConverterState state = { };
|
||||
QStringDecoder decoder(QStringDecoder::Utf8);
|
||||
QString text = decoder.decode(stream);
|
||||
|
||||
QTextCodec* codec = QTextCodec::codecForName("UTF-8");
|
||||
QString text = codec->toUnicode(stream.constData(), stream.length(), &state);
|
||||
if (state.invalidChars == 0)
|
||||
if (!decoder.hasError())
|
||||
{
|
||||
return text;
|
||||
}
|
||||
|
Reference in New Issue
Block a user