+ WIMLIB_ERR_UNICODE_STRING_NOT_REPRESENTABLE,
+ ERROR("Failed to convert UTF-16LE string to "
+ "multibyte string!");
+ ERROR("This may be because the UTF-16LE string "
+ "could not be represented\n"
+ " in your locale's character encoding."),
+ )
+#endif
+
+/* tchar to UTF-8 and back */
+#if TCHAR_IS_UTF16LE
+
+/* Windows */
+DEFINE_CHAR_CONVERSION_FUNCTIONS(tstr, "UTF-16LE", tchar,
+ utf8, "UTF-8", char,
+ false,
+ ,
+ in_nbytes * 2,
+ WIMLIB_ERR_INVALID_UTF16_STRING,
+ ERROR_WITH_ERRNO("Failed to convert UTF-16LE "
+ "string \"%"TS"\" to UTF-8 string!", in),
+ static)
+
+DEFINE_CHAR_CONVERSION_FUNCTIONS(utf8, "UTF-8", char,
+ tstr, "UTF-16LE", tchar,
+ false,
+ ,
+ in_nbytes * 2,
+ WIMLIB_ERR_INVALID_UTF8_STRING,
+ ERROR_WITH_ERRNO("Failed to convert UTF-8 string "
+ "to UTF-16LE string!"),
+ static)
+#else
+
+/* UNIX */
+
+DEFINE_CHAR_CONVERSION_FUNCTIONS(tstr, "", tchar,
+ utf8, "UTF-8", char,
+ true,
+ ,
+ in_nbytes * 4,