Open irssibot opened 18 years ago
irssi-recode_patch.diff
Suggested patch to fix the problem
diff -r irssi-0.8.10/src/core/recode.c irssi-0.8.10.patch/src/core/recode.c
50d49
< const char *from="UTF-8";
61c60,62
< recoded = g_convert(str, strlen(str), charset, from, NULL, NULL, NULL);
---
> recoded = g_convert(str, strlen(str), charset, "UTF-8", NULL, NULL, NULL);
> if (recoded == NULL)
> recoded = g_convert(str, strlen(str), charset, "ISO8859-1", NULL, NULL, NULL);
I added the diff also as a file, I pasted it first because I wasn't very well aware how this bug tracker works. Also I said reconv.c earlier although I of course meant recode.c.
On at least Solaris 8 iconv and possibly on other systems, conversions where from and to charsets are the same are not supported. So for example "UTF-8 -> UTF-8" conversion will always fail although "foo -> UTF-8" and "UTF-8 -> foo" works with almost any encoding as the value of foo. I suggest the following patch to be applied to reconv.c so that it first tries an "UTF-8 -> charset" conversion and if that fails it will try an "ISO8859-1 -> charset" conversion. I think this is the best way to handle the case if we want to keep the function generic as it's now. The patch follows:
50d49 < const char *from="UTF-8"; 61c60,62 < recoded = g_convert(str, strlen(str), charset, from, NULL, NULL, NULL);