mirror of
https://github.com/qpdf/qpdf.git
synced 2024-12-22 10:58:58 +00:00
Format code
This commit is contained in:
parent
54d8e920f1
commit
2d402e451c
@ -1,9 +1,9 @@
|
|||||||
#include <qpdf/QPDFObjectHandle.hh>
|
#include <qpdf/QPDFObjectHandle.hh>
|
||||||
|
|
||||||
#include <qpdf/BufferInputSource.hh>
|
#include <qpdf/BufferInputSource.hh>
|
||||||
|
#include <qpdf/JSON_writer.hh>
|
||||||
#include <qpdf/Pl_Buffer.hh>
|
#include <qpdf/Pl_Buffer.hh>
|
||||||
#include <qpdf/Pl_QPDFTokenizer.hh>
|
#include <qpdf/Pl_QPDFTokenizer.hh>
|
||||||
#include <qpdf/JSON_writer.hh>
|
|
||||||
#include <qpdf/QPDF.hh>
|
#include <qpdf/QPDF.hh>
|
||||||
#include <qpdf/QPDFExc.hh>
|
#include <qpdf/QPDFExc.hh>
|
||||||
#include <qpdf/QPDFLogger.hh>
|
#include <qpdf/QPDFLogger.hh>
|
||||||
|
@ -51,22 +51,21 @@ QPDF_String::writeJSON(int json_version, JSON::Writer& p)
|
|||||||
{
|
{
|
||||||
auto candidate = getUTF8Val();
|
auto candidate = getUTF8Val();
|
||||||
if (json_version == 1) {
|
if (json_version == 1) {
|
||||||
|
|
||||||
p << "\"" << JSON::Writer::encode_string(candidate) << "\"";
|
p << "\"" << JSON::Writer::encode_string(candidate) << "\"";
|
||||||
} else {
|
} else {
|
||||||
// See if we can unambiguously represent as Unicode.
|
// See if we can unambiguously represent as Unicode.
|
||||||
if (QUtil::is_utf16(this->val) || QUtil::is_explicit_utf8(this->val)) {
|
if (QUtil::is_utf16(this->val) || QUtil::is_explicit_utf8(this->val)) {
|
||||||
p << "\"u:" << JSON::Writer::encode_string(candidate) <<"\"";
|
p << "\"u:" << JSON::Writer::encode_string(candidate) << "\"";
|
||||||
return;
|
return;
|
||||||
} else if (!useHexString()) {
|
} else if (!useHexString()) {
|
||||||
std::string test;
|
std::string test;
|
||||||
if (QUtil::utf8_to_pdf_doc(candidate, test, '?') && (test == this->val)) {
|
if (QUtil::utf8_to_pdf_doc(candidate, test, '?') && (test == this->val)) {
|
||||||
// This is a PDF-doc string that can be losslessly encoded as Unicode.
|
// This is a PDF-doc string that can be losslessly encoded as Unicode.
|
||||||
p << "\"u:" << JSON::Writer::encode_string(candidate) <<"\"";
|
p << "\"u:" << JSON::Writer::encode_string(candidate) << "\"";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
p << "\"b:" << QUtil::hex_encode(val) <<"\"";
|
p << "\"b:" << QUtil::hex_encode(val) << "\"";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user