> If Mercurial were written in C, the most straightforward solution would be
> to use _setmode() to manage the text/binary mode of stdout. Like so:
> _setmode(_fileno(stdin), _O_BINARY);
> // print lines of diff
> _setmode(_fileno(stdin), _O_TEXT);
Thank you Lee, I did not know that, you just saved my day.
You can do that in lovely python also, setmode() is available through the msvcrt
module and it works fine on stdio streams. |