From 76fb9b6ac2e2dd1aca91a8814d040f37280a1935 Mon Sep 17 00:00:00 2001 From: Emanuele Giaquinta Date: Sat, 5 Apr 2008 13:07:26 +0000 Subject: Fix logic in recode_in: Honour recode_fallback also when the terminal encoding is not utf-8. Return the string as it is when the terminal encoding is utf-8, the string is valid utf-8, and the first conversion failed, rather than trying again the same conversion. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@4796 dbcabf3a-b0e7-0310-adc4-f8d773084564 --- src/core/recode.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/core/recode.c b/src/core/recode.c index 48f2811e..70768645 100644 --- a/src/core/recode.c +++ b/src/core/recode.c @@ -134,12 +134,13 @@ char *recode_in(const SERVER_REC *server, const char *str, const char *target) recoded = g_convert_with_fallback(str, len, to, from, NULL, NULL, NULL, NULL); if (!recoded) { - if (term_is_utf8) { - if (!str_is_utf8) - from = settings_get_str("recode_fallback"); - - } else if (str_is_utf8) - from = "UTF-8"; + if (str_is_utf8) + if (term_is_utf8) + return g_strdup(str); + else + from = "UTF-8"; + else + from = settings_get_str("recode_fallback"); if (from) recoded = g_convert_with_fallback(str, len, to, from, NULL, NULL, NULL, NULL); -- cgit v1.2.3