[PATCH] Enable to select encoding in hgrc web section

Hideya 'OhaC' OHASHI ohachige at gmail.com
Wed Jun 13 09:26:17 CDT 2007


Hi.
This is my first time to email to this mailing list.
I created patch, but this patch has some Japanese characters (manpage.)
So I'll email this without Japanese manpage.
You can pull this patch from my repository.
http://ohac.sytes.net/hgwebdir.cgi/mercurial/

---------- Forwarded message ----------
From: OHASHI Hideya <ohachige at gmail.com>
Date: 2007/06/13 23:10
Subject: [PATCH] Enable to select encoding in hgrc web section
To: ohachige at gmail.com


# HG changeset patch
# User OHASHI Hideya <ohachige at gmail.com>
# Date 1181726286 -32400
# Node ID 8964b8a9b2393790a135464a5f285c02aed376dc
# Parent  9338be783398a3c996b15d4bd4e3c5ea79efc8a8
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.

diff -r 9338be783398 -r 8964b8a9b239 doc/hgrc.5.txt
--- a/doc/hgrc.5.txt    Tue Jun 12 10:34:54 2007 -0500
+++ b/doc/hgrc.5.txt    Wed Jun 13 18:18:06 2007 +0900
@@ -536,6 +536,9 @@ web::
     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
diff -r 9338be783398 -r 8964b8a9b239 mercurial/hgweb/hgweb_mod.py
--- a/mercurial/hgweb/hgweb_mod.py      Tue Jun 12 10:34:54 2007 -0500
+++ b/mercurial/hgweb/hgweb_mod.py      Wed Jun 13 18:18:06 2007 +0900
@@ -103,6 +103,7 @@ class hgweb(object):
             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 @@ class hgweb(object):
     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()


More information about the Mercurial-devel mailing list