I'm going to change DiffItem.encode

1 view
Skip to first unread message

Alexander Belchenko

unread,
Aug 3, 2011, 6:26:45 AM8/3/11
to Iwata, qb...@googlegroups.com
Hi Hidetaka,

As you are the author of DiffItem API I'd like to talk about changing of
DiffItem.encode method.

In order to fix bug https://bugs.launchpad.net/qbzr/+bug/814117 I'm
going to change existing code to use l.decode(encodings[i],
errors='replace') so we will decode bytestream to unicode using the user
preferences rather than refusing such conversion because of mixed
content. That code has used 'strict' mode from the very beginning (I
think it was written this way by Lukas). But I think we can do a better
job if we allow the users to decide in which encoding they want to see
their files.

Also, I'd like to change the name of that method, I'd like to use name
"to_unicode" instead. "encode" in Python is method for conversion from
unicode to bytestream, while in our case we convert in the other way:
from bytestream to unicode (and that's a "decode" method in Python). So
I think "to_unicode" will speak the intent of the method much better.

If you have any comments or objections -- please, speak up. I'm going to
make such change in trunk, because it changes our API. As I can see
there are no other clients for DiffItem outside the QBzr, and inside
QBzr we're using it for qdiff and qshelve.

--
All the dude wanted was his rug back

Reply all
Reply to author
Forward
0 new messages