aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2019-01-13 14:00:14 +0100
committerJay Berkenbilt <ejb@ql.org>2019-01-17 17:43:56 +0100
commit698485468a8b7d0f38d817d6055898932f46cc26 (patch)
tree17fb98679692513f189d4b6049dcbce3333899bd /include
parent5cfcd4f361063df8e216489915758ce40a15f15b (diff)
downloadqpdf-698485468a8b7d0f38d817d6055898932f46cc26.tar.zst
Move remaining existing transcoding to QUtil
Diffstat (limited to 'include')
-rw-r--r--include/qpdf/QUtil.hh29
1 files changed, 26 insertions, 3 deletions
diff --git a/include/qpdf/QUtil.hh b/include/qpdf/QUtil.hh
index 8edef6e0..ea3f5da8 100644
--- a/include/qpdf/QUtil.hh
+++ b/include/qpdf/QUtil.hh
@@ -147,13 +147,18 @@ namespace QUtil
std::string toUTF8(unsigned long uval);
// Return a string containing the byte representation of the
- // UTF-16 BE encoding for the unicode value passed in.
+ // UTF-16 big-endian encoding for the unicode value passed in.
// Unrepresentable code points are converted to U+FFFD.
QPDF_DLL
std::string toUTF16(unsigned long uval);
- // Convert a UTF-8 encoded string to UTF-16. Unrepresentable code
- // points are converted to U+FFFD.
+ // Test whether this is a UTF-16 big-endian string. This is
+ // indicated by first two bytes being 0xFE 0xFF.
+ QPDF_DLL
+ bool is_utf16(std::string const&);
+
+ // Convert a UTF-8 encoded string to UTF-16 big-endian.
+ // Unrepresentable code points are converted to U+FFFD.
QPDF_DLL
std::string utf8_to_utf16(std::string const& utf8);
@@ -169,6 +174,24 @@ namespace QUtil
QPDF_DLL
std::string utf8_to_mac_roman(
std::string const& utf8, char unknown_char = '?');
+ QPDF_DLL
+ std::string utf8_to_pdf_doc(
+ std::string const& utf8, char unknown_char = '?');
+
+ // Convert a UTF-16 big-endian encoded string to UTF-8.
+ // Unrepresentable code points are converted to U+FFFD.
+ QPDF_DLL
+ std::string utf16_to_utf8(std::string const& utf16);
+
+ // Convert from the specified single-byte encoding system to
+ // UTF-8. There is no ascii_to_utf8 because all ASCII strings are
+ // already valid UTF-8.
+ QPDF_DLL
+ std::string win_ansi_to_utf8(std::string const& win);
+ QPDF_DLL
+ std::string mac_roman_to_utf8(std::string const& mac);
+ QPDF_DLL
+ std::string pdf_doc_to_utf8(std::string const& pdfdoc);
// If secure random number generation is supported on your
// platform and qpdf was not compiled with insecure random number