summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEmanuele Giaquinta <exg@irssi.org>2008-04-05 13:07:26 +0000
committerexg <exg@dbcabf3a-b0e7-0310-adc4-f8d773084564>2008-04-05 13:07:26 +0000
commit76fb9b6ac2e2dd1aca91a8814d040f37280a1935 (patch)
treed3d83d6f99be17396c2bde1cc4b44768e517abb1 /src
parent2f13aacf43b3bdd5b6c3818882af878d4306880a (diff)
downloadirssi-76fb9b6ac2e2dd1aca91a8814d040f37280a1935.zip
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
Diffstat (limited to 'src')
-rw-r--r--src/core/recode.c13
1 files changed, 7 insertions, 6 deletions
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);