Index: utf8.c =================================================================== --- utf8.c (revision 2246) +++ utf8.c (working copy) @@ -56,6 +56,7 @@ static iconv_t iconv_desc = (iconv_t)(-1); static iconv_t files_iconv_desc = (iconv_t)(-1); static iconv_t xterm_iconv_desc = (iconv_t)(-1); +static iconv_t stream_iconv_desc = (iconv_t)(-1); char *iconv_rcc (char *str) @@ -147,6 +148,11 @@ return iconv_str (xterm_iconv_desc, str); } +char *stream_iconv_str (const char *str) +{ + return iconv_str (stream_iconv_desc, str); +} + int xwaddstr (WINDOW *win, const char *str) { int res; @@ -451,3 +459,14 @@ return tail; } + +void stream_iconv_init () +{ + char *encoding; + + encoding = options_get_str ("StreamMetadataEncoding"); + if (encoding) + { + stream_iconv_desc = iconv_open ("UTF-8", encoding); + } +} Index: utf8.h =================================================================== --- utf8.h (revision 2246) +++ utf8.h (working copy) @@ -22,6 +22,7 @@ #define WIDTH_MAX 2048 void utf8_init (); +void stream_iconv_init (); void utf8_cleanup (); int xwaddstr (WINDOW *win, const char *str); int xwaddnstr (WINDOW *win, const char *str, const int n); @@ -42,6 +43,7 @@ char *iconv_rcc (char *str); char *files_iconv_str (const char *str); char *xterm_iconv_str (const char *str); +char *stream_iconv_str (const char *str); #ifdef __cplusplus } Index: io.c =================================================================== --- io.c (revision 2246) +++ io.c (working copy) @@ -40,6 +40,7 @@ #include "options.h" #ifdef HAVE_CURL # include "io_curl.h" +# include "utf8.h" #endif #include "compat.h" @@ -792,7 +793,11 @@ LOCK (s->metadata.mutex); if (s->metadata.title) free (s->metadata.title); +#ifdef HAVE_CURL + s->metadata.title = stream_iconv_str (title); +#else s->metadata.title = xstrdup (title); +#endif UNLOCK (s->metadata.mutex); } Index: server.c =================================================================== --- server.c (revision 2246) +++ server.c (working copy) @@ -48,6 +48,7 @@ #include "files.h" #include "softmixer.h" #include "equalizer.h" +#include "utf8.h" #define SERVER_LOG "mocp_server_log" #define PID_FILE "pid" @@ -332,6 +335,7 @@ fatal ("listen() failed: %s", strerror(errno)); audio_initialize (); + stream_iconv_init (); tags_cache_init (&tags_cache, options_get_int("TagsCacheSize")); tags_cache_load (&tags_cache, create_file_name("cache")); clients_init (); Index: options.c =================================================================== --- options.c (revision 2246) +++ options.c (working copy) @@ -491,6 +491,7 @@ option_add_bool ("CanStartInPlaylist", true); option_add_bool ("UseCursorSelection", false); option_add_str ("ID3v1TagsEncoding", "WINDOWS-1250", CHECK_NONE); + option_add_str ("StreamMetadataEncoding", "", CHECK_NONE); option_add_bool ("UseRCC", true); option_add_bool ("UseRCCForFilesystem", true); option_add_bool ("EnforceTagsEncoding", false); Index: config.example =================================================================== --- config.example (revision 2246) +++ config.example (working copy) @@ -164,6 +164,9 @@ # Use librcc to filenames and directory names encoding. #UseRCCForFilesystem = yes +# Convert a stream title from a given encoding. +# StreamMetadataEncoding = EUC-KR + # Remember the playlist after exit? SavePlaylist = yes