diff options
author | m-holger <m-holger@kubitscheck.org> | 2024-02-12 19:40:21 +0100 |
---|---|---|
committer | m-holger <m-holger@kubitscheck.org> | 2024-02-16 12:00:20 +0100 |
commit | 9589fad1e5bde7c51f01c0de16ac0b5ccb7051e0 (patch) | |
tree | 9357fc9099cefcb06f587597d0606d50260aeca8 /libqpdf/QPDF_String.cc | |
parent | 9379b768118f465e94f826bed1daacbbc94938fc (diff) | |
download | qpdf-9589fad1e5bde7c51f01c0de16ac0b5ccb7051e0.tar.zst |
Reimplement QPDFObjectHandle::getJSON in terms of writeJSON
Diffstat (limited to 'libqpdf/QPDF_String.cc')
-rw-r--r-- | libqpdf/QPDF_String.cc | 29 |
1 files changed, 0 insertions, 29 deletions
diff --git a/libqpdf/QPDF_String.cc b/libqpdf/QPDF_String.cc index d3fcaaef..f425b313 100644 --- a/libqpdf/QPDF_String.cc +++ b/libqpdf/QPDF_String.cc @@ -46,35 +46,6 @@ QPDF_String::unparse() return unparse(false); } -JSON -QPDF_String::getJSON(int json_version) -{ - if (json_version == 1) { - return JSON::makeString(getUTF8Val()); - } - // See if we can unambiguously represent as Unicode. - bool is_unicode = false; - std::string result; - std::string candidate = getUTF8Val(); - if (QUtil::is_utf16(this->val) || QUtil::is_explicit_utf8(this->val)) { - is_unicode = true; - result = candidate; - } else if (!useHexString()) { - std::string test; - if (QUtil::utf8_to_pdf_doc(candidate, test, '?') && (test == this->val)) { - // This is a PDF-doc string that can be losslessly encoded as Unicode. - is_unicode = true; - result = candidate; - } - } - if (is_unicode) { - result = "u:" + result; - } else { - result = "b:" + QUtil::hex_encode(this->val); - } - return JSON::makeString(result); -} - void QPDF_String::writeJSON(int json_version, JSON::Writer& p) { |