Mercurial > hg
changeset 980:023891f99732
Fixes truncating utf-8 buddy names (Myhailo Danylenko)
This patch fixes the problem with utf-8 buddy names,
which include multibyte characters. Without patch names
will be decreased by as many extra bytes as we have in name.
Note by Mikael: When a non-UTF-8 locale is used, the conversion from
UTF-8 could fail, which gave a "(null)" buddy name.
author | Mikael Berthe <mikael@lilotux.net> |
---|---|
date | Sat, 21 Oct 2006 15:00:41 +0200 |
parents | ea939ff047d8 |
children | 553b8ecf901f |
files | mcabber/src/screen.c |
diffstat | 1 files changed, 5 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/mcabber/src/screen.c Sat Oct 21 11:22:15 2006 +0200 +++ b/mcabber/src/screen.c Sat Oct 21 15:00:41 2006 +0200 @@ -1169,7 +1169,7 @@ for (i=0; i<maxy && buddy; buddy = g_list_next(buddy)) { unsigned short bflags, btype, ismsg, isgrp, ismuc, ishid, isspe; - gchar *rline_locale; + gchar *name_locale; bflags = buddy_getflags(BUDDATA(buddy)); btype = buddy_gettype(BUDDATA(buddy)); @@ -1221,8 +1221,9 @@ wattrset(rosterWnd, get_color(COLOR_ROSTER)); } + name_locale = from_utf8(buddy_getname(BUDDATA(buddy))); if (Roster_Width > 7) - strncpy(name, buddy_getname(BUDDATA(buddy)), Roster_Width-7); + strncpy(name, name_locale, Roster_Width-7); else name[0] = 0; @@ -1252,9 +1253,8 @@ " %c%c%c%c %s", pending, sepleft, status, sepright, name); } - rline_locale = from_utf8(rline); - mvwprintw(rosterWnd, i, x_pos, "%s", rline_locale); - g_free(rline_locale); + mvwprintw(rosterWnd, i, x_pos, "%s", rline); + g_free(name_locale); i++; }