[RFH/MERGE 3/3] Towards XML log output: An implementation of XmlLogFormatter

Martin Pool mbp at canonical.com
Wed Nov 8 06:09:38 GMT 2006


On  4 Nov 2006, James Westby <jw+debian at jameswestby.net> wrote:
> Hi,
> 
> Attached is an implementation of XmlLogFormatter. It should be easy to
> change the format if wanted. The current output can be seen in the
> testcase.
> 
> It passes the tests that I have written but it is not complete yet, and
> that is why I ask for help. Running it on bzr.dev it fails with
>   
>   UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position
>   12: ordinal not in range(128)
> 
> Apparently trying to output one of dato's commits. I thought something
> like this might happen, but I was expecting it to be Erik that triggered
> it.
> 
> In the test case I do use some non-ascii characters, but I must have
> picked badly, as the test case passes. 
> 
> I have spent a bit of time trying to unicode() some bits, and change the
> encoding that I pass to elementtree's output method, but none of these
> seem to make any difference. 
> 
> If someone has any clues that might help me fix that I would be
> grateful.

The problem seems to come from some Revisions being passed in which have
a .committer which is utf-8 bytes, not unicode.  I don't know yet why
that is happening -- it may be that ElementTree doesn't always decode
them.

Aside from that problem the patch looks reasonable, but it may be better
to emit xml through _encode_and_escape as in xml5.py -- amongst other
things that lets you stream it out.

-- 
Martin




More information about the bazaar mailing list