aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--beweb/common.cfg2
-rw-r--r--libbe/bugdir.py5
-rw-r--r--libbe/cmdutil.py4
-rw-r--r--libbe/mapfile.py4
4 files changed, 10 insertions, 5 deletions
diff --git a/beweb/common.cfg b/beweb/common.cfg
index 50febb5..de0d84f 100644
--- a/beweb/common.cfg
+++ b/beweb/common.cfg
@@ -5,3 +5,5 @@ staticFilter.dir = "static"
[/favicon.ico]
staticFilter.on = True
staticFilter.file = "static/images/favicon.ico"
+[/]
+decodingFilter.on = True
diff --git a/libbe/bugdir.py b/libbe/bugdir.py
index d30bc75..766ccd9 100644
--- a/libbe/bugdir.py
+++ b/libbe/bugdir.py
@@ -345,7 +345,7 @@ class Comment(object):
self.date = utility.str_to_time(mapfile["Date"])
self.From = mapfile["From"]
self.in_reply_to = mapfile.get("In-reply-to")
- self.body = file(self.get_path("body")).read()
+ self.body = file(self.get_path("body")).read().decode("utf-8")
else:
self.date = None
self.From = None
@@ -358,7 +358,8 @@ class Comment(object):
if not os.path.exists(self.get_path(None)):
self.bug.rcs.mkdir(self.get_path(None))
map_save(self.bug.rcs, self.get_path("values"), map_file)
- self.bug.rcs.set_file_contents(self.get_path("body"), self.body)
+ self.bug.rcs.set_file_contents(self.get_path("body"),
+ self.body.encode('utf-8'))
def get_path(self, name):
diff --git a/libbe/cmdutil.py b/libbe/cmdutil.py
index ca28cdf..2f24490 100644
--- a/libbe/cmdutil.py
+++ b/libbe/cmdutil.py
@@ -16,6 +16,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
import bugdir
import plugin
+import locale
import os
import optparse
import utility
@@ -98,7 +99,8 @@ def get_command(command_name):
return cmd
def execute(cmd, args):
- return get_command(cmd).execute(args)
+ encoding = locale.getpreferredencoding() or 'ascii'
+ return get_command(cmd).execute([a.decode(encoding) for a in args])
def help(cmd):
return get_command(cmd).help()
diff --git a/libbe/mapfile.py b/libbe/mapfile.py
index 3760938..bbbd860 100644
--- a/libbe/mapfile.py
+++ b/libbe/mapfile.py
@@ -67,7 +67,7 @@ def generate(f, map, context=3):
for key in keys:
for i in range(context):
f.write("\n")
- f.write("%s=%s\n" % (key, map[key]))
+ f.write("%s=%s\n" % (key.encode("utf-8"), map[key].encode("utf-8")))
for i in range(context):
f.write("\n")
@@ -94,7 +94,7 @@ def parse(f):
line = line.rstrip('\n')
if len(line) == 0:
continue
- name,value = line.split('=', 1)
+ name,value = [f.decode('utf-8') for f in line.split('=', 1)]
assert not result.has_key('name')
result[name] = value
return result