[PATCH] hgweb: override the charset attribute in the http request

elson.wei at gmail.com elson.wei at gmail.com
Thu Apr 10 02:12:52 CDT 2014


# HG changeset patch
# User Wei, Elson <elson.wei at gmail.com>
# Date 1397113932 -28800
#      Thu Apr 10 15:12:12 2014 +0800
# Node ID 2fccd923044071bb78ae03aa5ddfbab358564514
# Parent  dbf0fa39a5b81a226a8953e91c7d5a151d453e06
hgweb: override the charset attribute in the http request

The default http request character set is UTF-8. If the message is not encoded
in UTF-8, such as big5, it cannot be shown correctly. The 'charset' is
overridden by the root document's, such that the user can select the proper
encoding in the browser.

diff --git a/mercurial/templates/static/mercurial.js b/mercurial/templates/static/mercurial.js
--- a/mercurial/templates/static/mercurial.js
+++ b/mercurial/templates/static/mercurial.js
@@ -327,6 +327,7 @@
     };
 
     xfr.open(method, url);
+    xfr.overrideMimeType("text/xhtml; charset=" + document.characterSet.toLowerCase());
     xfr.send();
     onstart();
     return xfr;


More information about the Mercurial-devel mailing list