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

elson elson.wei at gmail.com
Fri Apr 11 05:35:56 CDT 2014


2014-04-10 20:13 GMT+08:00 Mads Kiilerich <mads at kiilerich.com>:

> 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
>

If the commit message is written in the encoding other than UTF-8, the
ajax-loaded message will be shown incorrectly like other ajax applications.

I might modify the description as following:

    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'
inherits
    from the root document, such that the browser or the user can determine
what
    the encoding should be used.


>
>
>> 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
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20140411/92e124ed/attachment.html>


More information about the Mercurial-devel mailing list