Ejemplo n.º 1
0
// Convert the data in buf to UTF-8. The charset argument can be an iconv
// codepage, a value returned by mp_charset_conv_guess(), or a special value
// that triggers autodetection of the charset (e.g. using ENCA).
// The auto-detection is the only difference to mp_iconv_to_utf8().
//  buf: same as mp_iconv_to_utf8()
//  user_cp: iconv codepage, special value, NULL
//  flags: same as mp_iconv_to_utf8()
//  returns: same as mp_iconv_to_utf8()
bstr mp_charset_guess_and_conv_to_utf8(struct mp_log *log, bstr buf,
                                       const char *user_cp, int flags)
{
    void *tmp = talloc_new(NULL);
    const char *cp = mp_charset_guess(tmp, log, buf, user_cp, flags);
    bstr res = mp_iconv_to_utf8(log, buf, cp, flags);
    talloc_free(tmp);
    return res;
}
Ejemplo n.º 2
0
// Convert the data in buf to UTF-8. The charset argument can be an iconv
// codepage, a value returned by mp_charset_conv_guess(), or a special value
// that triggers autodetection of the charset (e.g. using ENCA).
// The auto-detection is the only difference to mp_iconv_to_utf8().
//  buf: same as mp_iconv_to_utf8()
//  user_cp: iconv codepage, special value, NULL
//  flags: same as mp_iconv_to_utf8()
//  returns: same as mp_iconv_to_utf8()
bstr mp_charset_guess_and_conv_to_utf8(struct mp_log *log, bstr buf,
                                       const char *user_cp, int flags)
{
    return mp_iconv_to_utf8(log, buf, mp_charset_guess(log, buf, user_cp, flags),
                            flags);
}
Ejemplo n.º 3
0
// Convert the data in buf to UTF-8. The charset argument can be an iconv
// codepage, a value returned by mp_charset_conv_guess(), or a special value
// that triggers autodetection of the charset (e.g. using ENCA).
// The auto-detection is the only difference to mp_iconv_to_utf8().
//  buf: same as mp_iconv_to_utf8()
//  user_cp: iconv codepage, special value, NULL
//  flags: same as mp_iconv_to_utf8()
//  returns: same as mp_iconv_to_utf8()
bstr mp_charset_guess_and_conv_to_utf8(bstr buf, const char *user_cp, int flags)
{
    return mp_iconv_to_utf8(buf, mp_charset_guess(buf, user_cp, flags), flags);
}