From: Max Kellermann Date: Thu, 2 Oct 2008 17:01:30 +0000 (+0200) Subject: screen_lyrics: character set conversion X-Git-Tag: v0.12_alpha1~102 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=fe84050389a15b45ee8071ebdc85488d8d3d36b4;p=ncmpc.git screen_lyrics: character set conversion Convert the lyrics to the current character set before displaying them. --- diff --git a/src/screen_lyrics.c b/src/screen_lyrics.c index 927b3dd..b1812de 100644 --- a/src/screen_lyrics.c +++ b/src/screen_lyrics.c @@ -26,6 +26,7 @@ #include "screen_utils.h" #include "strfsong.h" #include "lyrics.h" +#include "charset.h" #include "gcc.h" #define _GNU_SOURCE @@ -221,10 +222,17 @@ static int store_lyr_hd(void) static const char * list_callback(unsigned idx, mpd_unused int *highlight, mpd_unused void *data) { + static char buffer[256]; + char *value; + if (idx >= current.lines->len) return NULL; - return g_ptr_array_index(current.lines, idx); + value = utf8_to_locale(g_ptr_array_index(current.lines, idx)); + g_strlcpy(buffer, value, sizeof(buffer)); + free(value); + + return buffer; }