diff --git a/libqpdf/QPDF_String.cc b/libqpdf/QPDF_String.cc index 931ccd61..5604ff10 100644 --- a/libqpdf/QPDF_String.cc +++ b/libqpdf/QPDF_String.cc @@ -184,9 +184,9 @@ QPDF_String::getUTF8Val() const return QUtil::utf16_to_utf8(this->val); } else if ((val.length() >= 3) && - (val[0] == '\xEF') && - (val[1] == '\xBB') && - (val[2] == '\xBF')) + (val.at(0) == '\xEF') && + (val.at(1) == '\xBB') && + (val.at(2) == '\xBF')) { // PDF 2.0 allows UTF-8 strings when explicitly prefixed with // the above bytes, which is just UTF-8 encoding of U+FEFF.