diff options
author | Max Kellermann <max@duempel.org> | 2008-10-02 19:01:30 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2008-10-02 19:01:30 +0200 |
commit | fe84050389a15b45ee8071ebdc85488d8d3d36b4 (patch) | |
tree | d36ef5fdb5768174919aaa5bd57dd53a054966d4 /src | |
parent | 299b9c138b3104b92fafb47082a220f906946c66 (diff) | |
download | mpd-fe84050389a15b45ee8071ebdc85488d8d3d36b4.tar.gz mpd-fe84050389a15b45ee8071ebdc85488d8d3d36b4.tar.xz mpd-fe84050389a15b45ee8071ebdc85488d8d3d36b4.zip |
screen_lyrics: character set conversion
Convert the lyrics to the current character set before displaying
them.
Diffstat (limited to 'src')
-rw-r--r-- | src/screen_lyrics.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/screen_lyrics.c b/src/screen_lyrics.c index 927b3dd9c..b1812de31 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; } |