Encoding problem in bzrlib.trace.mutter()
James Henstridge
james at jamesh.id.au
Fri Dec 2 04:18:50 GMT 2005
There is a bug in bzrlib.trace.mutter()'s handling of unicode strings,
which was causing exceptions when doing merges of the Launchpad tree. A
fix can be found in my branch here:
http://people.ubuntu.com/~jamesh/bzr.smallfixes (not quite finished
mirroring)
Here is a short description of the problem:
1. a Unicode string is passed to mutter()
2. mutter() converts the unicode string to UTF-8 and writes it to
_trace_file
3. _trace_file is a codec-wrapped file object, which will convert
unicode strings to UTF-8 on write.
4. If it receives a normal 8-bit string, it will first convert it to
unicode, assuming it is in the default encoding (ASCII).
If the original unicode string contained non-ASCII characters then you
get an exception at (4), since it's UTF-8 representation isn't clean ASCII.
The patch removes the encode() call from mutter(), and updates the test
suite to use a codec-wrapped temporary log file.
With it applied, the existing test for logging unicode strings passes
and I'm able to successfully merge the problem tree (and I get correctly
encoded UTF-8 in ~/.bzr.log).
James.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mutter-encoding-fix.patch
Type: text/x-patch
Size: 1037 bytes
Desc: not available
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20051202/95ac608e/attachment.bin
More information about the bazaar
mailing list