From 02281632ccbba3ef00a6968bfd697f4be836d0dd Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Thu, 3 Jan 2019 20:03:30 -0500 Subject: Add QUtil::utf8_to_ascii --- include/qpdf/QUtil.hh | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'include') diff --git a/include/qpdf/QUtil.hh b/include/qpdf/QUtil.hh index 96c0530b..5532149c 100644 --- a/include/qpdf/QUtil.hh +++ b/include/qpdf/QUtil.hh @@ -152,6 +152,12 @@ namespace QUtil QPDF_DLL std::string toUTF16(unsigned long uval); + // Convert a UTF-8 encoded string to ASCII by replacing all + // characters outside of ascii with the given unknown_char. + QPDF_DLL + std::string utf8_to_ascii( + std::string const& utf8, char unknown_char = '?'); + // 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 -- cgit v1.2.3-54-g00ecf