Example #1
0
void
str_init_strings (const char *termenc)
{
    codeset = g_strdup ((termenc != NULL) ? termenc : str_detect_termencoding ());

    str_cnv_not_convert = g_iconv_open (codeset, codeset);
    if (str_cnv_not_convert == INVALID_CONV)
    {
        if (termenc != NULL)
        {
            g_free (codeset);
            codeset = g_strdup (str_detect_termencoding ());
            str_cnv_not_convert = g_iconv_open (codeset, codeset);
        }

        if (str_cnv_not_convert == INVALID_CONV)
        {
            g_free (codeset);
            codeset = g_strdup ("ascii");
            str_cnv_not_convert = g_iconv_open (codeset, codeset);
        }
    }

    str_cnv_to_term = str_cnv_not_convert;
    str_cnv_from_term = str_cnv_not_convert;

    str_choose_str_functions ();
}
Example #2
0
File: strutil.c Project: CTU-OSP/mc
void
str_init_strings (const char *termenc)
{
    codeset = termenc != NULL ? g_ascii_strup (termenc, -1) : g_strdup (str_detect_termencoding ());

    str_cnv_not_convert = g_iconv_open (codeset, codeset);
    if (str_cnv_not_convert == INVALID_CONV)
    {
        if (termenc != NULL)
        {
            g_free (codeset);
            codeset = g_strdup (str_detect_termencoding ());
            str_cnv_not_convert = g_iconv_open (codeset, codeset);
        }

        if (str_cnv_not_convert == INVALID_CONV)
        {
            g_free (codeset);
            codeset = g_strdup (DEFAULT_CHARSET);
            str_cnv_not_convert = g_iconv_open (codeset, codeset);
        }
    }

    str_cnv_to_term = str_cnv_not_convert;
    str_cnv_from_term = str_cnv_not_convert;

    str_choose_str_functions ();
}