1
0
mirror of https://github.com/irssi/irssi.git synced 2024-12-04 14:46:39 -05:00

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
This commit is contained in:
Emanuele Giaquinta 2008-04-05 13:07:26 +00:00 committed by exg
parent 2f13aacf43
commit 76fb9b6ac2

View File

@ -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);