[FFmpeg-devel] [PATCH] avutil/log: in colored_fputs, convert string from utf8 to CP_ACP charset on Windows

Derek Buitenhuis derek.buitenhuis at gmail.com
Thu Feb 20 17:45:34 CET 2014


On 2/20/2014 4:33 PM, Anshul wrote:
> I do write callback for avlog in such conditions, but it would be good if someone make an option that only use ascii, it would be better if there would be function like avset_log_ch_fmt().
> It would also benifit when we redirect log in text file. In text file all the character that are used for color look like garbage.

Currently, as it stands, colors are not written when redirected to a text
file in any sane environment.

I am with Jan on this one. It is a *bad* idea. We shouldn't hack around cmd.exe's
legacy crap (that will never change btw, according to MS) by mucking with the encoding
like this. It violates the principle of least astonishment[1] -- everyone expects output
to be unicode, including our own FATE scripts. Also, this would probably break output
in the MSYS terminal, which handles unicode fine.

More over, even for what this patch wants to do, it does it wrong. The correct way can
would be to use _setmode() with _O_U8TEXT, as seen here:

https://web.archive.org/web/20130215014133/http://blogs.msdn.com/b/michkap/archive/2008/03/18/8306597.aspx

(MS move his blog so I can't find the current page.)

- Derek

[1] http://en.wikipedia.org/wiki/Principle_of_least_astonishment


More information about the ffmpeg-devel mailing list