Commit 2d402e451cad84e28a988eefbfcdbd580cf733fc
1 parent
54d8e920
Format code
Showing
2 changed files
with
4 additions
and
5 deletions
libqpdf/QPDFObjectHandle.cc
| 1 | #include <qpdf/QPDFObjectHandle.hh> | 1 | #include <qpdf/QPDFObjectHandle.hh> |
| 2 | 2 | ||
| 3 | #include <qpdf/BufferInputSource.hh> | 3 | #include <qpdf/BufferInputSource.hh> |
| 4 | +#include <qpdf/JSON_writer.hh> | ||
| 4 | #include <qpdf/Pl_Buffer.hh> | 5 | #include <qpdf/Pl_Buffer.hh> |
| 5 | #include <qpdf/Pl_QPDFTokenizer.hh> | 6 | #include <qpdf/Pl_QPDFTokenizer.hh> |
| 6 | -#include <qpdf/JSON_writer.hh> | ||
| 7 | #include <qpdf/QPDF.hh> | 7 | #include <qpdf/QPDF.hh> |
| 8 | #include <qpdf/QPDFExc.hh> | 8 | #include <qpdf/QPDFExc.hh> |
| 9 | #include <qpdf/QPDFLogger.hh> | 9 | #include <qpdf/QPDFLogger.hh> |
libqpdf/QPDF_String.cc
| @@ -51,22 +51,21 @@ QPDF_String::writeJSON(int json_version, JSON::Writer& p) | @@ -51,22 +51,21 @@ QPDF_String::writeJSON(int json_version, JSON::Writer& p) | ||
| 51 | { | 51 | { |
| 52 | auto candidate = getUTF8Val(); | 52 | auto candidate = getUTF8Val(); |
| 53 | if (json_version == 1) { | 53 | if (json_version == 1) { |
| 54 | - | ||
| 55 | p << "\"" << JSON::Writer::encode_string(candidate) << "\""; | 54 | p << "\"" << JSON::Writer::encode_string(candidate) << "\""; |
| 56 | } else { | 55 | } else { |
| 57 | // See if we can unambiguously represent as Unicode. | 56 | // See if we can unambiguously represent as Unicode. |
| 58 | if (QUtil::is_utf16(this->val) || QUtil::is_explicit_utf8(this->val)) { | 57 | if (QUtil::is_utf16(this->val) || QUtil::is_explicit_utf8(this->val)) { |
| 59 | - p << "\"u:" << JSON::Writer::encode_string(candidate) <<"\""; | 58 | + p << "\"u:" << JSON::Writer::encode_string(candidate) << "\""; |
| 60 | return; | 59 | return; |
| 61 | } else if (!useHexString()) { | 60 | } else if (!useHexString()) { |
| 62 | std::string test; | 61 | std::string test; |
| 63 | if (QUtil::utf8_to_pdf_doc(candidate, test, '?') && (test == this->val)) { | 62 | if (QUtil::utf8_to_pdf_doc(candidate, test, '?') && (test == this->val)) { |
| 64 | // This is a PDF-doc string that can be losslessly encoded as Unicode. | 63 | // This is a PDF-doc string that can be losslessly encoded as Unicode. |
| 65 | - p << "\"u:" << JSON::Writer::encode_string(candidate) <<"\""; | 64 | + p << "\"u:" << JSON::Writer::encode_string(candidate) << "\""; |
| 66 | return; | 65 | return; |
| 67 | } | 66 | } |
| 68 | } | 67 | } |
| 69 | - p << "\"b:" << QUtil::hex_encode(val) <<"\""; | 68 | + p << "\"b:" << QUtil::hex_encode(val) << "\""; |
| 70 | } | 69 | } |
| 71 | } | 70 | } |
| 72 | 71 |