Fixed iconv problem, causing truncated words when using iso locale

This commit is contained in:
Sebastien Helleu 2007-01-08 15:43:21 +00:00
parent a1bbfb0129
commit 66161f5249
4 changed files with 34 additions and 10 deletions

View File

@ -1,10 +1,11 @@
WeeChat - Wee Enhanced Environment for Chat
===========================================
ChangeLog - 2007-01-07
ChangeLog - 2007-01-08
Version 0.2.3 (under dev!):
* fixed iconv problem, causing truncated words when using iso locale
* fixed topic scroll when topic has multi-bytes chars
* fixed compilation problem with iconv under FreeBSD
* fixed bugs with charset: now decodes/encodes nicks and channels in IRC

View File

@ -200,10 +200,8 @@ weechat_iconv (char *from_code, char *to_code, char *string)
#ifdef HAVE_ICONV
iconv_t cd;
char *inbuf;
char *inbuf, *ptr_inbuf, *ptr_outbuf, *next_char;
int done;
char *ptr_inbuf;
char *ptr_outbuf;
size_t err, inbytesleft, outbytesleft;
if (from_code && from_code[0] && to_code && to_code[0]
@ -236,7 +234,20 @@ weechat_iconv (char *from_code, char *to_code, char *string)
done = 1;
break;
case EILSEQ:
ptr_inbuf[0] = '?';
next_char = utf8_next_char (ptr_inbuf);
if (next_char)
{
inbytesleft -= next_char - ptr_inbuf;
ptr_inbuf = next_char;
}
else
{
inbytesleft--;
ptr_inbuf++;
}
ptr_outbuf[0] = '?';
ptr_outbuf++;
outbytesleft--;
break;
}
}

View File

@ -1,10 +1,11 @@
WeeChat - Wee Enhanced Environment for Chat
===========================================
ChangeLog - 2007-01-07
ChangeLog - 2007-01-08
Version 0.2.3 (under dev!):
* fixed iconv problem, causing truncated words when using iso locale
* fixed topic scroll when topic has multi-bytes chars
* fixed compilation problem with iconv under FreeBSD
* fixed bugs with charset: now decodes/encodes nicks and channels in IRC

View File

@ -200,10 +200,8 @@ weechat_iconv (char *from_code, char *to_code, char *string)
#ifdef HAVE_ICONV
iconv_t cd;
char *inbuf;
char *inbuf, *ptr_inbuf, *ptr_outbuf, *next_char;
int done;
char *ptr_inbuf;
char *ptr_outbuf;
size_t err, inbytesleft, outbytesleft;
if (from_code && from_code[0] && to_code && to_code[0]
@ -236,7 +234,20 @@ weechat_iconv (char *from_code, char *to_code, char *string)
done = 1;
break;
case EILSEQ:
ptr_inbuf[0] = '?';
next_char = utf8_next_char (ptr_inbuf);
if (next_char)
{
inbytesleft -= next_char - ptr_inbuf;
ptr_inbuf = next_char;
}
else
{
inbytesleft--;
ptr_inbuf++;
}
ptr_outbuf[0] = '?';
ptr_outbuf++;
outbytesleft--;
break;
}
}