UnicodeDecodeError in merge-directive

John Arbash Meinel john at arbash-meinel.com
Tue May 8 17:08:53 BST 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Adeodato Simó wrote:
> Hello.
> 
> I tried a 'merge-directive' command, and I obtained the following error
> (with bzr.dev):
> 
>   bzr: ERROR: exceptions.UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 302: ordinal not in range(128)
> 
>   Traceback (most recent call last):
>     File "/home/adeodato/devel/bzr/bzr.dev/bzrlib/commands.py", line 718, in run_bzr_catch_errors
>       return run_bzr(argv)
>     File "/home/adeodato/devel/bzr/bzr.dev/bzrlib/commands.py", line 679, in run_bzr
>       ret = run(*run_argv)
>     File "/home/adeodato/devel/bzr/bzr.dev/bzrlib/commands.py", line 375, in run_argv_aliases
>       return self.run(**all_cmd_args)
>     File "/home/adeodato/devel/bzr/bzr.dev/bzrlib/builtins.py", line 3552, in run
>       self.outf.writelines(directive.to_lines())
>     File "codecs.py", line 186, in writelines
>       self.write(''.join(list))
>     File "codecs.py", line 178, in write
>       data, consumed = self.encode(object, self.errors)
>   UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 302: ordinal not in range(128)


This sounds like something is mixing Unicode strings with byte (8-bit)
strings.

Most likely it means that 'list' is containing a Unicode commit message,
and the output of "show_diff_trees" or "bundle".

I handled this in the 'email' plugin by always making the 8-bit text
(diff/bundle) an attachment, and had it encoded specifically differently.

We may want to just the bzr-email SMTPConnection class into bzr core.

It could use a very small refactoring to remove the specific dependency
on Config at the base level.

So we would have a "SMTPConnection" base class that just needs  to know
about a server, and then either a child class, or just a helper function
which understands Config and sets the values on SMTPConnection correctly.

If someone is interested in working on it, I'm happy to mentor.

...

> Please let me know if you need more information (CC me as I'm not
> subscribed).
> 
> P.S.: There's a typo in HACKING in line 190: prestine for pristine.
> 

Thanks for the bug report.

John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGQKCVJdeBCYSNAAMRAlVQAJ9IYLq/V9xV+WPWbM8layHhpn60sACgrWvT
ufEvm8Wmgy6myVHs/tZEGyI=
=URRq
-----END PGP SIGNATURE-----



More information about the bazaar mailing list