aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf/QPDF_String.cc
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2022-04-23 22:39:27 +0200
committerJay Berkenbilt <ejb@ql.org>2022-04-24 00:25:43 +0200
commit22b35c49289157204b35a851f3cb9cade9e98559 (patch)
tree49b9f289b1feccaefe04355dd80c5e7c10917cbc /libqpdf/QPDF_String.cc
parent5bbb0d4c307bff58e9928a1c757438d033687ce3 (diff)
downloadqpdf-22b35c49289157204b35a851f3cb9cade9e98559.tar.zst
Expose QUtil::get_next_utf8_codepoint
Diffstat (limited to 'libqpdf/QPDF_String.cc')
-rw-r--r--libqpdf/QPDF_String.cc6
1 files changed, 2 insertions, 4 deletions
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);