[FFmpeg-devel] [PATCH] ffmpeg/fftools: Set activeCodePage as UTF-8 on Windows

Martin Storsjö martin at martin.st
Tue Nov 12 00:30:31 EET 2024


On Mon, 11 Nov 2024, Lars Weber wrote:

> Recent changes in MSYS2 have changed the default console code page, which was discussed here: https://github.com/msys2/MINGW-packages/issues/22462
> This results in FFMpeg compiled with that toolchain no longer accepting UTF-8 paths,
> unless the UTF-8 codepage is actively selected through fftools.manifest.

This description seems inaccurate to me.

There hasn't been any change in default console code page.

On Windows, the command line string used to launch each process is a 
unicode string. If the called executable isn't built in unicode mode, the 
command line string gets converted to the active code page, with a 
best-fit conversion. If that conversion isn't exact (i.e. it does a 
best-fit adaptation to the current code page), this can lead to security 
issues in some cases.

The linked mingw-w64 commit therefore changed so that process startup 
errors out if the unicode command line can't be exactly converted to the 
current active code page.

By flagging an executable as using utf8 as active code page, the vast 
majority of unicode command lines can be converted to the active code 
page, reducing the cases where the error occurs.

The mechanisms around this change are still being discussed on the 
mingw-w64-public mailing list, so the current form isn't necessarily final 
yet.

// Martin



More information about the ffmpeg-devel mailing list