From 22b35c49289157204b35a851f3cb9cade9e98559 Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Sat, 23 Apr 2022 16:39:27 -0400 Subject: Expose QUtil::get_next_utf8_codepoint --- libqpdf/QPDF_String.cc | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'libqpdf/QPDF_String.cc') diff --git a/libqpdf/QPDF_String.cc b/libqpdf/QPDF_String.cc index 89ddc498..30d6708b 100644 --- a/libqpdf/QPDF_String.cc +++ b/libqpdf/QPDF_String.cc @@ -166,11 +166,9 @@ QPDF_String::getUTF8Val() const { if (QUtil::is_utf16(this->val)) { return QUtil::utf16_to_utf8(this->val); - } else if ( - (val.length() >= 3) && (val.at(0) == '\xEF') && (val.at(1) == '\xBB') && - (val.at(2) == '\xBF')) { + } else if (QUtil::is_explicit_utf8(this->val)) { // PDF 2.0 allows UTF-8 strings when explicitly prefixed with - // the above bytes, which is just UTF-8 encoding of U+FEFF. + // the three-byte representation of U+FEFF. return this->val.substr(3); } else { return QUtil::pdf_doc_to_utf8(this->val); -- cgit v1.2.3-54-g00ecf