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

Mads Kiilerich mads at kiilerich.com
Thu Apr 10 07:13:24 CDT 2014


On 04/10/2014 09:12 AM, elson.wei at gmail.com wrote:
> # 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.

Is this something everybody would want? In which cases will it change 
the default behaviour? In which cases will it force the user to select 
the proper encoding in the browser where it used to (perhaps 
accidentally) do the right thing?

/Mads

>
> 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;
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel



More information about the Mercurial-devel mailing list