Discussion:
Unicode characters in command line arguments
(too old to reply)
marky
2008-03-06 12:50:16 UTC
Permalink
Hi.

Not sure if this is the right place to ask but here goes anyway.

The following takes place on WinXP SP2 ENU + Microsoft Visual C++ .NET
2003 version 7.1.3088.

Consider a sample MFC project with default settings via
File|New|Project...|Visual C++ Projects|MFC Application

If I go to Project Properties, under 'Debugging' and enter some
Unicode characters in 'Command Arguments' they are not sent
correctly to the application. At least not according to the debugger.
Hitting F11 to step into AfxWinMain, most non-ASCII characters
are replaced with question marks '?'.

I did #define both UNICODE and _UNICODE and set the program entry point
to wWinMainCRTStartup.

How to go about supporting Unicode command line arguments in an MFC app?

Thx,

marky
Alex Blekhman
2008-03-07 12:41:12 UTC
Permalink
Post by marky
If I go to Project Properties, under 'Debugging' and enter some
Unicode characters in 'Command Arguments' they are not sent
correctly to the application. At least not according to the
debugger.
Hitting F11 to step into AfxWinMain, most non-ASCII characters
are replaced with question marks '?'.
I did #define both UNICODE and _UNICODE and set the program
entry point
to wWinMainCRTStartup.
Visual Studio may use temporary batch files to run the debugee.
Batch files are known for very poor support of non-ASCII
characters. You can try to run the application by yourself from
command prompt. In the beginning of main/wmain function put
`__debugbreak()' call or show message box and attach with debugger
to the process.

HTH
Alex
news.microsoft.com
2008-03-09 19:21:00 UTC
Permalink
Post by Alex Blekhman
Post by marky
If I go to Project Properties, under 'Debugging' and enter some
Unicode characters in 'Command Arguments' they are not sent
correctly to the application. At least not according to the
debugger.
Hitting F11 to step into AfxWinMain, most non-ASCII characters
are replaced with question marks '?'.
I did #define both UNICODE and _UNICODE and set the program
entry point
to wWinMainCRTStartup.
Visual Studio may use temporary batch files to run the debugee.
Batch files are known for very poor support of non-ASCII
characters. You can try to run the application by yourself from
command prompt. In the beginning of main/wmain function put
`__debugbreak()' call or show message box and attach with debugger
to the process.
HTH
Alex
It did help! Thanks a lot! I showed a message box at the top
of AfxWinMain() and was able to attach the debugger to the
process and see what was happening. Everything worked alright.
It was only the debugger IDE that was initially unable to pass
correct command line in.

Thanks once again.

marky

Loading...