+
+/* A pointer to 'mbchar' indicates a string of "multibyte characters" provided
+ * in the default encoding of the user's locale, which may be "UTF-8",
+ * "ISO-8859-1", "C", or any other ASCII-compatible encoding.
+ * "ASCII-compatible" here means any encoding where all ASCII characters have
+ * the same representation, and any non-ASCII character is represented as a
+ * sequence of one or more bytes not already used by any ASCII character. */
+typedef char mbchar;
+
+/* A pointer to 'utf8char' indicates a UTF-8 encoded string */
+typedef char utf8char;
+
+/* Note: in some places in the code, strings of plain old 'char' are still used.
+ * This means that the string is being operated on in an ASCII-compatible way,
+ * and may be either a multibyte or UTF-8 string. */
+
+/* A pointer to 'utf16lechar' indicates a UTF-16LE encoded string */
+typedef u16 utf16lechar;
+
+extern size_t
+utf16le_strlen(const utf16lechar *s);
+
+/* encoding.c */
+extern void
+iconv_global_cleanup();
+
+extern bool wimlib_mbs_is_utf8;
+
+#define DECLARE_CHAR_CONVERSION_FUNCTIONS(varname1, varname2, \
+ chartype1, chartype2) \
+ \
+extern int \
+varname1##_to_##varname2##_nbytes(const chartype1 *in, size_t in_nbytes,\
+ size_t *out_nbytes_ret); \
+ \
+extern int \
+varname1##_to_##varname2##_buf(const chartype1 *in, size_t in_nbytes, \
+ chartype2 *out); \
+ \
+extern int \
+varname1##_to_##varname2(const chartype1 *in, size_t in_nbytes, \
+ chartype2 **out_ret, \
+ size_t *out_nbytes_ret); \
+
+/* multi-byte string to UTF16-LE string */
+DECLARE_CHAR_CONVERSION_FUNCTIONS(mbs, utf16le, mbchar, utf16lechar);
+
+/* UTF16-LE string to multi-byte string */
+DECLARE_CHAR_CONVERSION_FUNCTIONS(utf16le, mbs, utf16lechar, mbchar);
+
+/* UTF-8 string to multi-byte string */
+DECLARE_CHAR_CONVERSION_FUNCTIONS(utf8, mbs, utf8char, mbchar);
+
+extern bool
+utf8_str_contains_nonascii_chars(const utf8char *utf8_str);