If transliterations don't work in the system (eg. Solaris), don't allow

recode_transliterate setting to be enabled.



git-svn-id: http://svn.irssi.org/repos/irssi/trunk@4082 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Timo Sirainen 2005-11-19 18:13:18 +00:00 committed by cras
commit 342141fcb2
4 changed files with 25 additions and 9 deletions

View file

@ -37,19 +37,31 @@ static gboolean recode_get_charset(const char **charset)
}
#endif
static gboolean is_translit(const char *charset)
{
char *pos;
pos = stristr(charset, "//translit");
return (pos != NULL);
}
gboolean is_valid_charset(const char *charset)
{
#ifdef HAVE_GLIB2
const char *from="UTF-8";
const char *str="irssi";
char *recoded;
char *recoded, *to = NULL;
gboolean valid;
if (!charset || *charset == '\0')
return FALSE;
if (settings_get_bool("recode_transliterate") && !is_translit(charset))
charset = to = g_strconcat(charset, "//TRANSLIT", NULL);
recoded = g_convert(str, strlen(str), charset, from, NULL, NULL, NULL);
valid = (recoded != NULL);
g_free(recoded);
g_free(to);
return valid;
#else
if (!charset || *charset =='\0')
@ -58,13 +70,6 @@ gboolean is_valid_charset(const char *charset)
#endif
}
static gboolean is_translit(const char *charset)
{
char *pos;
pos = stristr(charset, "//translit");
return (pos != NULL);
}
char *recode_in(const SERVER_REC *server, const char *str, const char *target)
{
#ifdef HAVE_GLIB2