changeset 4690:ecea4de3104e

Enable to select encoding in hgrc web section This patch provides character encoding setting in each repository. After this patch, You can use multi encoding repositories with one mercurial server.
author OHASHI Hideya <ohachige at gmail.com>
date Wed, 13 Jun 2007 18:18:06 +0900
parents 54a2b94a372c
children ca4971347e0a
files doc/hgrc.5.txt mercurial/hgweb/hgweb_mod.py
diffstat 2 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/doc/hgrc.5.txt	Sat Jun 23 21:11:28 2007 +0200
+++ b/doc/hgrc.5.txt	Wed Jun 13 18:18:06 2007 +0900
@@ -551,6 +551,9 @@
     Which template map style to use.
   templates;;
     Where to find the HTML templates. Default is install path.
+  encoding;;
+    Character encoding name.
+    Example: "UTF-8"
 
 
 AUTHOR
--- a/mercurial/hgweb/hgweb_mod.py	Sat Jun 23 21:11:28 2007 +0200
+++ b/mercurial/hgweb/hgweb_mod.py	Wed Jun 13 18:18:06 2007 +0900
@@ -103,6 +103,7 @@
             self.maxshortchanges = int(self.config("web", "maxshortchanges", 60))
             self.maxfiles = int(self.config("web", "maxfiles", 10))
             self.allowpull = self.configbool("web", "allowpull", True)
+            self.encoding = self.config("web", "encoding", util._encoding)
 
     def archivelist(self, nodeid):
         allowed = self.configlist("web", "allow_archive")
@@ -655,7 +656,7 @@
     def run_wsgi(self, req):
         def header(**map):
             header_file = cStringIO.StringIO(
-                ''.join(self.t("header", encoding=util._encoding, **map)))
+                ''.join(self.t("header", encoding=self.encoding, **map)))
             msg = mimetools.Message(header_file, 0)
             req.header(msg.items())
             yield header_file.read()