From: Jaroslav Kysela Date: Tue, 20 Oct 2015 12:01:48 +0000 (+0200) Subject: WEBUI: dvrfile - convert back the subscription file id to utf8 X-Git-Tag: v4.2.1~1863 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2d996fcb600763bc545fe4ce2396da0a5d2a4ebc;p=thirdparty%2Ftvheadend.git WEBUI: dvrfile - convert back the subscription file id to utf8 --- diff --git a/src/webui/webui.c b/src/webui/webui.c index d1362675f..5ea3d8242 100644 --- a/src/webui/webui.c +++ b/src/webui/webui.c @@ -1468,7 +1468,7 @@ page_dvrfile(http_connection_t *hc, const char *remain, void *opaque) struct stat st; const char *content = NULL, *range, *filename; dvr_entry_t *de; - char *fname; + char *fname, *charset; char *basename; char *str, *str0; char range_buf[255]; @@ -1510,6 +1510,7 @@ page_dvrfile(http_connection_t *hc, const char *remain, void *opaque) fname = tvh_strdupa(filename); content = muxer_container_type2mime(de->de_mc, 1); + charset = de->de_config ? de->de_config->dvr_charset_id : NULL; pthread_mutex_unlock(&global_lock); @@ -1585,10 +1586,17 @@ page_dvrfile(http_connection_t *hc, const char *remain, void *opaque) http_stream_postop(tcp_id); tcp_id = NULL; } else { - basename = malloc(strlen(fname) + 7 + 1); + str = intlconv_to_utf8safestr(charset, fname, strlen(fname) * 3); + if (str == NULL) + str = intlconv_to_utf8safestr(intlconv_charset_id("ASCII", 1, 1), + fname, strlen(fname) * 3); + if (str == NULL) + str = strdup("error"); + basename = malloc(strlen(str) + 7 + 1); strcpy(basename, "file://"); - strcat(basename, fname); + strcat(basename, str); sub->ths_dvrfile = basename; + free(str); } } pthread_mutex_unlock(&global_lock);