1 #ifndef MP_CHARSET_CONV_H
2 #define MP_CHARSET_CONV_H
3 
4 #include <stdbool.h>
5 #include "misc/bstr.h"
6 
7 struct mp_log;
8 
9 enum {
10     MP_ICONV_VERBOSE = 1,       // print errors instead of failing silently
11     MP_ICONV_ALLOW_CUTOFF = 2,  // allow partial input data
12     MP_STRICT_UTF8 = 4,         // don't fall back to UTF-8-BROKEN when guessing
13     MP_NO_LATIN1_FALLBACK = 8,  // fall back to input buffer instead of latin1
14 };
15 
16 bool mp_charset_is_utf8(const char *user_cp);
17 bool mp_charset_is_utf16(const char *user_cp);
18 const char *mp_charset_guess(void *talloc_ctx, struct mp_log *log, bstr buf,
19                              const char *user_cp, int flags);
20 bstr mp_iconv_to_utf8(struct mp_log *log, bstr buf, const char *cp, int flags);
21 
22 #endif
23