diff mercurial/hgweb/webcommands.py @ 28212:d4419c01532b

templatefilters: make json filter be byte-transparent (BC) (issue4926) This is necessary to preserve filename encoding over JSON. Instead, this patch inserts "|utf8" where non-ascii local-encoding texts can be passed to "|json". See also the commit that introduced "utf8" filter.
author Yuya Nishihara <yuya@tcha.org>
date Sun, 27 Dec 2015 17:59:57 +0900
parents 446465888119
children ca0c0ca30c62
line wrap: on
line diff
--- a/mercurial/hgweb/webcommands.py	Mon Jan 04 23:05:09 2016 +0900
+++ b/mercurial/hgweb/webcommands.py	Sun Dec 27 17:59:57 2015 +0900
@@ -1196,7 +1196,8 @@
                 canvaswidth=(cols + 1) * bg_height,
                 truecanvasheight=rows * bg_height,
                 canvasheight=canvasheight, bg_height=bg_height,
-                jsdata=lambda **x: graphdata(True, str),
+                # {jsdata} will be passed to |json, so it must be in utf-8
+                jsdata=lambda **x: graphdata(True, encoding.fromlocal),
                 nodes=lambda **x: graphdata(False, str),
                 node=ctx.hex(), changenav=changenav)