Ssupport for UTF-8 in "be comment" calls to EDITOR/VISUAL.
authorW. Trevor King <wking@drexel.edu>
Mon, 3 Aug 2009 23:27:00 +0000 (19:27 -0400)
committerW. Trevor King <wking@drexel.edu>
Mon, 3 Aug 2009 23:27:00 +0000 (19:27 -0400)
becommands/comment.py
libbe/editor.py

index 69e3a416ca97239a7e66957a1708f1a8940cd6bf..9a614b26916ae6e412bbebb852ab20fc473103eb 100644 (file)
@@ -104,7 +104,6 @@ def execute(args, manipulate_encodings=True):
             raise cmdutil.UserError, "No comment supplied, and EDITOR not specified."
         if body is None:
             raise cmdutil.UserError("No comment entered.")
-        body = body.decode('utf-8')
     elif args[1] == '-': # read body from stdin
         binary = not (options.content_type == None
                       or options.content_type.startswith("text/"))
index 93144b82001aeb276424643c73d5f9ceaafaf45a..8f2bdbfcce782a37449720b59addb85fc10ec3af 100644 (file)
@@ -62,7 +62,8 @@ def editor_string(comment=None, encoding=None):
     fhandle, fname = tempfile.mkstemp()
     try:
         if comment is not None:
-            os.write(fhandle, '\n'+comment_string(comment))
+            cstring = u'\n'+comment_string(comment)
+            os.write(fhandle, cstring.encode(encoding))
         os.close(fhandle)
         oldmtime = os.path.getmtime(fname)
         os.system("%s %s" % (editor, fname))