MediaInfoLib icon indicating copy to clipboard operation
MediaInfoLib copied to clipboard

MediaInfo_Open doesn't open files with specific characters like 'ü' in filename

Open disc-kuraudo opened this issue 6 months ago • 4 comments

The library function MediaInfo_Open fails to open files that have specific characters like 'ü' in the filename, see sample program and files attached.

mediainfo and mediainfo-gui work with these files no problem.

This happens under Linux with MediaInfoLib version 25.09, with the 'ü' character stored as UTF-8 0xC3 0xBC.

mediainfo_ue.c ü.png (save as ü.png, this one doesn't work) u.png (save as u.png, this one does work)

disc-kuraudo avatar Oct 30 '25 18:10 disc-kuraudo

Try

MediaInfo_Option(mi, "CharSet", "UTF-8");
MediaInfo_Option(mi, "setlocale_LC_CTYPE", "");

cjee21 avatar Oct 30 '25 18:10 cjee21

You didn't indicate to the OS that you expect UTF-8 (or any OS config) input, by default it is not UTF-8. setlocale(LC_ALL, ""); for using OS settings. Or @cjee21 suggestion (it forces MediaInfoLib to consider the input as UTF-8, but it would fail if the OS sends an argument in another locale, rare nowadays).

JeromeMartinez avatar Oct 30 '25 18:10 JeromeMartinez

Thank you, the setlocale(LC_ALL, "") seems to work.

But still strikes me as odd how a lib can't open filenames that libc functions have no problem with.

Read through https://github.com/MediaArea/MediaInfo/issues/134 that it's more of a platform interoperability issue.

disc-kuraudo avatar Oct 30 '25 21:10 disc-kuraudo

But still strikes me as odd how a lib can't open filenames that libc functions have no problem with.

I would have expected that it is same with the libc without this init, I need to check again the related code there at some point.

JeromeMartinez avatar Oct 30 '25 21:10 JeromeMartinez