From 86249fff9a9c45faef963731fa36fe2866986a54 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 12 Dec 2010 04:36:37 +0100 Subject: [PATCH] Handle unicode decoding of commit messages in bzr-fastimport, python-fastimport no longer takes care of this. --- bzr_commit_handler.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bzr_commit_handler.py b/bzr_commit_handler.py index c47a39d..1df4c86 100644 --- a/bzr_commit_handler.py +++ b/bzr_commit_handler.py @@ -261,7 +261,12 @@ class GenericCommitHandler(processor.CommitHandler): self._save_author_info(rev_props) committer = self.command.committer who = self._format_name_email(committer[0], committer[1]) - message = self.command.message + try: + message = self.command.message.decode("utf-8") + except UnicodeDecodeError: + self.warning( + "commit message not in utf8 - replacing unknown characters") + message = message.decode('utf-8', 'replace') if not _serializer_handles_escaping: # We need to assume the bad ol' days message = helpers.escape_commit_message(message) -- 2.11.4.GIT