From fe84050389a15b45ee8071ebdc85488d8d3d36b4 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 2 Oct 2008 19:01:30 +0200 Subject: [PATCH] screen_lyrics: character set conversion Convert the lyrics to the current character set before displaying them. --- src/screen_lyrics.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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; } -- 2.30.2