]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Set error page Content-Type character set to UTF-8
authorAmos Jeffries <squid3@treenet.co.nz>
Mon, 20 Jan 2014 01:20:40 +0000 (14:20 +1300)
committerAmos Jeffries <squid3@treenet.co.nz>
Mon, 20 Jan 2014 01:20:40 +0000 (14:20 +1300)
This fixes issues with some user agents displaying non-English / ASCII
error page translations. Our translation system uses and produces UTF-8
templates for the langpack content.

It also encourages UTF-8 usage in third-party error pages.

src/errorpage.cc

index 8091c4a16280af84e49b75d839278851d4647023..6c25de0ae2542148fee02128ed17f66f9696268d 100644 (file)
@@ -1166,7 +1166,7 @@ ErrorState::BuildHttpReply()
                 status = Http::scTemporaryRedirect;
         }
 
-        rep->setHeaders(status, NULL, "text/html", 0, 0, -1);
+        rep->setHeaders(status, NULL, "text/html;charset=utf-8", 0, 0, -1);
 
         if (request) {
             MemBuf redirect_location;
@@ -1178,7 +1178,7 @@ ErrorState::BuildHttpReply()
         httpHeaderPutStrf(&rep->header, HDR_X_SQUID_ERROR, "%d %s", httpStatus, "Access Denied");
     } else {
         MemBuf *content = BuildContent();
-        rep->setHeaders(httpStatus, NULL, "text/html", content->contentSize(), 0, -1);
+        rep->setHeaders(httpStatus, NULL, "text/html;charset=utf-8", content->contentSize(), 0, -1);
         /*
          * include some information for downstream caches. Implicit
          * replaceable content. This isn't quite sufficient. xerrno is not