+/* UNIX */
+
+DEFINE_CHAR_CONVERSION_FUNCTIONS(tstr, "", tchar,
+ utf8, "UTF-8", char,
+ true,
+ ,
+ in_nbytes * 4,
+ WIMLIB_ERR_INVALID_MULTIBYTE_STRING,
+ ERROR_WITH_ERRNO("Failed to convert multibyte "
+ "string \"%"TS"\" to UTF-8 string!", in);
+ ERROR("If the data you provided was UTF-8, please make sure "
+ "the character\n"
+ " encoding of your current locale is UTF-8."),
+ static)
+
+DEFINE_CHAR_CONVERSION_FUNCTIONS(utf8, "UTF-8", char,
+ tstr, "", tchar,
+ true,
+ ,
+ in_nbytes * 4,
+ WIMLIB_ERR_UNICODE_STRING_NOT_REPRESENTABLE,
+ ERROR("Failed to convert UTF-8 string to "
+ "multibyte string!");
+ ERROR("This may be because the UTF-8 data "
+ "could not be represented\n"
+ " in your locale's character encoding."),
+ static)
+#endif
+
+int
+tstr_to_utf8_simple(const tchar *tstr, char **out)
+{
+ size_t out_nbytes;
+ return tstr_to_utf8(tstr, tstrlen(tstr) * sizeof(tchar),
+ out, &out_nbytes);
+}
+
+int
+utf8_to_tstr_simple(const char *utf8str, tchar **out)
+{
+ size_t out_nbytes;
+ return utf8_to_tstr(utf8str, strlen(utf8str), out, &out_nbytes);
+}