UnicodeError writing change summary into commit message template
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Bazaar |
Fix Released
|
High
|
Unassigned |
Bug Description
I got the following error when trying to commit after a merge changes from the Launchpad rocketfuel branch.
$ bzr commit
bzr: ERROR: 'ascii' codec can't encode character u'\ufffd' in position 29: ordinal not in range(128)
command: '/usr/bin/bzr' 'commit'
pwd: u'/home/
error: exceptions.
at /usr/lib/
see ~/.bzr.log for debug information
The relevant entry from ~/.bzr.log is:
[10834] Wed 14:57:08.264 ERROR: 'ascii' codec can't encode character u'\ufffd' in position 29: ordinal not in range(128)
command: '/usr/bin/bzr' 'commit'
pwd: u'/home/
error: exceptions.
Traceback (most recent call last):
File "/usr/lib/
return run_bzr(argv)
File "/usr/lib/
ret = cmd_obj.
File "/usr/lib/
return self.run(
File "/usr/lib/
to_
File "/usr/lib/
print >> to_file, ' ', line_log(
UnicodeEncodeError: 'ascii' codec can't encode character u'\ufffd' in position 29: ordinal not in range(128)
This is with jbailey's bzr packages (bzr-0.
The problem is caused by changeset Arch-1:<email address hidden> %launchpad- -pre-ubz- specs-- 0--patch- 22
This contains a \xfffd, which is a unicode replacement character. That character can't be converted to ascii.
This character occurs in the changeset because the original arch changeset contains a \xc2 character (meta-b), probably because of a typo when it was originally committed. This is not a valid utf-8 character (or unicode character.) I don't know what character set baz import expects the arch log messages to be; it's not specified by baz.
So a couple of possible changes:
- when producing the commit message template we should write out in the user's preferred encoding
- that encoding should be done with errors=replace so that users who are using ascii won't be messed up by strange things in merged commits
- baz import should perhaps be smarter about non-ascii arch messages
James can work around this by giving the commit message from a file or on the command line, avoiding generation of the template.