summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2010-12-12 04:36:37 +0100
committerJelmer Vernooij <jelmer@samba.org>2010-12-12 04:36:37 +0100
commit86249fff9a9c45faef963731fa36fe2866986a54 (patch)
tree4382b4c69bb8279cf6f03e5ab25fe369cc2653b6
parentc9633a2d2b3d29917c4dbbfaa6f10da20fc8ce77 (diff)
downloadbzr-fastimport-86249fff9a9c45faef963731fa36fe2866986a54.tar.gz
Handle unicode decoding of commit messages in bzr-fastimport, python-fastimport no longer takes care of this.
-rw-r--r--bzr_commit_handler.py7
1 files changed, 6 insertions, 1 deletions
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)