From 3b96373f9ae82deb5b18ab8aae58ab39a0a7764e Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Mon, 3 Aug 2009 19:27:00 -0400 Subject: Ssupport for UTF-8 in "be comment" calls to EDITOR/VISUAL. --- becommands/comment.py | 1 - libbe/editor.py | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/becommands/comment.py b/becommands/comment.py index 69e3a41..9a614b2 100644 --- a/becommands/comment.py +++ b/becommands/comment.py @@ -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/")) diff --git a/libbe/editor.py b/libbe/editor.py index 93144b8..8f2bdbf 100644 --- a/libbe/editor.py +++ b/libbe/editor.py @@ -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)) -- cgit