diff --git a/src/admin.c b/src/admin.c
index ddf49211..81e2b6c3 100644
--- a/src/admin.c
+++ b/src/admin.c
@@ -278,7 +278,7 @@ void admin_send_response (xmlDocPtr doc, client_t *client,
/* FIXME: in this section we hope no function will ever return -1 */
len = util_http_build_header(client->refbuf->data, buf_len, 0,
0, 200, NULL,
- "text/xml", NULL,
+ "text/xml", "utf-8",
NULL);
len += snprintf (client->refbuf->data + len, buf_len - len, "Content-Length: %d\r\n\r\n%s", xmlStrlen(buff), buff);
@@ -572,7 +572,7 @@ static void html_success(client_t *client, char *message)
ret = util_http_build_header(client->refbuf->data, PER_CLIENT_REFBUF_SIZE, 0,
0, 200, NULL,
- "text/html", NULL,
+ "text/html", "utf-8",
"");
snprintf(client->refbuf->data + ret, PER_CLIENT_REFBUF_SIZE - ret,
"
Admin request successful"
@@ -1031,7 +1031,7 @@ static void command_list_mounts(client_t *client, int response)
{
util_http_build_header(client->refbuf->data, PER_CLIENT_REFBUF_SIZE, 0,
0, 200, NULL,
- "text/plain", NULL,
+ "text/plain", "utf-8",
"");
client->refbuf->len = strlen (client->refbuf->data);
client->respcode = 200;
diff --git a/src/client.c b/src/client.c
index cc597c5b..a911bcfc 100644
--- a/src/client.c
+++ b/src/client.c
@@ -189,7 +189,7 @@ static void client_send_error(client_t *client, int status, int plain, const cha
ret = util_http_build_header(client->refbuf->data, PER_CLIENT_REFBUF_SIZE, 0,
0, status, NULL,
- plain ? "text/plain" : "text/html", NULL,
+ plain ? "text/plain" : "text/html", "utf-8",
plain ? message : "");
if (!plain)
diff --git a/src/xslt.c b/src/xslt.c
index 0c9dfbe5..d8b5bcc4 100644
--- a/src/xslt.c
+++ b/src/xslt.c
@@ -191,6 +191,7 @@ void xslt_transform(xmlDocPtr doc, const char *xslfilename, client_t *client)
xmlChar *string;
int len, problem = 0;
const char *mediatype = NULL;
+ const char *charset = NULL;
xmlSetGenericErrorFunc ("", log_parse_failure);
xsltSetGenericErrorFunc ("", log_parse_failure);
@@ -211,7 +212,10 @@ void xslt_transform(xmlDocPtr doc, const char *xslfilename, client_t *client)
if (xsltSaveResultToString (&string, &len, res, cur) < 0)
problem = 1;
- /* lets find out the content type to use */
+ /* lets find out the content type and character encoding to use */
+ if (cur->encoding)
+ charset = (char *)cur->encoding;
+
if (cur->mediaType)
mediatype = (char *)cur->mediaType;
else
@@ -234,7 +238,7 @@ void xslt_transform(xmlDocPtr doc, const char *xslfilename, client_t *client)
if (string == NULL)
string = xmlCharStrdup ("");
- ret = util_http_build_header(refbuf->data, full_len, 0, 0, 200, NULL, mediatype, NULL, NULL);
+ ret = util_http_build_header(refbuf->data, full_len, 0, 0, 200, NULL, mediatype, charset, NULL);
snprintf (refbuf->data + ret, full_len - ret,
"Content-Length: %d\r\n\r\n%s",
len, string);