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

Martin Pool mbp at canonical.com
Wed Nov 8 06:43:12 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.

OK, I think the problem is this: eventually you come to write this to
cmd_log.outf, and that wants to reencode things.  xml needs different
output encoding to plain text: you should either always do utf-8 or
(better?) always entity-escape.

-- 
Martin




More information about the bazaar mailing list