Opened 10 years ago

Closed 10 years ago

Last modified 7 years ago

#287 closed enhancement (fixed)

unicode under windows

Reported by: Anton Sergunov Owned by: Michael Niedermayer
Priority: normal Component: ffmpeg
Version: unspecified Keywords: utf8 windows
Cc: setosha@gmail.com Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

It will be nice to make unicode wrapper for main() under win32.

somthing like this

int wmain(int argc, wchar_t* argv[])
{
    char** cargs = new char*[argc];
    for(int i=0; i<argc; ++i)
    {
        int len = WideCharToMultiByte(CP_UTF8, 0, argv[i], -1, NULL, -1, NULL, NULL);
        if(len < 0)
            len = 0;
        cargs[i] = new char[len+1];
        len = WideCharToMultiByte(CP_UTF8, 0, argv[i], -1, cargs[i], len, NULL, NULL);
        cargs[i][len] = 0;
    }
    int ret = ffmpeg_main(argc, cargs); // rename your main
    for(int i=0; i<argc; ++i)
        delete[] cargs[i];
    delete[] cargs;

    return ret;
}

ffmpeg -metadata treats input char strings as utf8 strings, but under windows it's not true. They comes to main() as local single char encoding. Determinate local encoding in tagger not always right. Because some symbols may not covered by local encoding

Change History (6)

comment:1 by Anton Sergunov, 10 years ago

But opening files trough fopen or fstream. Those function will fails on symbols which not in latin1 codepage

comment:2 by Michael Niedermayer, 10 years ago

note, few ffmpeg developers have windows systems, thus it might help if you send a patch

comment:3 by reimar, 10 years ago

Resolution: fixed
Status: newclosed

This issue has been fixed differently a long time ago.

comment:4 by Roger Pack, 7 years ago

could somebody point me to the diff that fixed this by chance?

comment:5 by Carl Eugen Hoyos, 7 years ago

Keywords: utf8 added; unicode removed

comment:6 by gjdfgh, 7 years ago

You'll have to find it yourself, but look at prepare_app_arguments() in cmdutils.c.

Note: See TracTickets for help on using tickets.