SrsBusiness / mp4v2

Automatically exported from code.google.com/p/mp4v2
Other
0 stars 0 forks source link

[Enhancement] Win32 Unicode command line support for utility programs #144

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Quick hack to support Unicode command line arguments support on utility 
programs.
Added a new class mp4v2::platform::prog::CommandLine on platform layer, both 
for Posix and Win32 implementation.
It takes argc and argv, and just returns passed argc/argv on Posix case.
On win32, it returns UTF8 argc/argv pair retrieved from MSVCRT.
Tested on Linux, mingw-w64 (cross compile on Linux), and MSVC.

By this patch, Unicode file names given by command line argument are properly 
handled on Win32 environment.
However, this patch doesn't fix internal UTF8 string directly printed to 
stdout/stderr, which result in what is called "mojibake", if console codepage 
is not set to CP65001 (on Windows).

Original issue reported on code.google.com by honeycom...@gmail.com on 29 Oct 2012 at 7:50

Attachments:

GoogleCodeExporter commented 8 years ago
Looks good--I'll try to get to this during the week.

Original comment by kid...@gmail.com on 29 Oct 2012 at 1:13

GoogleCodeExporter commented 8 years ago
Hi,
By the way, on windows argv[0] can be filled with full path name with .exe 
extension, which is somewhat cumbersome as a program name printed in messages.
I didn't take care of this, but this CommandLine class is also a convenient 
place to edit argv[0] nicely.

Original comment by honeycom...@gmail.com on 29 Oct 2012 at 2:10