aboutsummaryrefslogtreecommitdiffstats
path: root/include/qpdf/QUtil.hh
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2019-01-13 15:41:13 +0100
committerJay Berkenbilt <ejb@ql.org>2019-01-17 17:43:56 +0100
commit8f389f14c0584861c712c049bdba3ed0d9036506 (patch)
treef7f85a3f7f5ba29e16238f589724a60d1b59728f /include/qpdf/QUtil.hh
parent6817ca585a44eec2c50961ba7c714b419774da36 (diff)
downloadqpdf-8f389f14c0584861c712c049bdba3ed0d9036506.tar.zst
QUtil::analyze_encoding
Diffstat (limited to 'include/qpdf/QUtil.hh')
-rw-r--r--include/qpdf/QUtil.hh14
1 files changed, 14 insertions, 0 deletions
diff --git a/include/qpdf/QUtil.hh b/include/qpdf/QUtil.hh
index ea3f5da8..d9b0783e 100644
--- a/include/qpdf/QUtil.hh
+++ b/include/qpdf/QUtil.hh
@@ -193,6 +193,20 @@ namespace QUtil
QPDF_DLL
std::string pdf_doc_to_utf8(std::string const& pdfdoc);
+ // Analyze a string for encoding. We can't tell the difference
+ // between any single-byte encodings, and we can't tell for sure
+ // whether a string that happens to be valid UTF-8 isn't a
+ // different encoding, but we can at least tell a few things to
+ // help us guess. If there are no characters with the high bit
+ // set, has_8bit_chars is false, and the other values are also
+ // false, even though ASCII strings are valid UTF-8. is_valid_utf8
+ // means that the string is non-trivially valid UTF-8.
+ QPDF_DLL
+ void analyze_encoding(std::string const& str,
+ bool& has_8bit_chars,
+ bool& is_valid_utf8,
+ bool& is_utf16);
+
// If secure random number generation is supported on your
// platform and qpdf was not compiled with insecure random number
// generation, this returns a cryptographically secure random