Of course, every console based applications have the same problem. This includes gacutil.
In 1.0 and 1.1, gacutil translate everything to ANSI, then use printf to show the result. This is certainly not unicode friendly as not every unicode can be translated to ANSI code page.
In Whidbey, we do the following:
Our approach is, always call WideCharToMultiByte with GetConsoleOutputCP(), then call WriteFile to output the result. This way it does not matter if the output is console, or file, or pipe, and what OS it is running on, as long as the console is about to show the characters.
Dr. International has the follow code sample in his book “Developing International Software” version 2:
wchar_t* szwOut ;
HANDLE outHandle = GetStdHandle(STD_OUTPUT_HANDLE);
// ThreadLocale adjustment, resource loading, etc. is skipped
if( (GetFileType(outHandle) & FILE_TYPE_CHAR) &&
GetConsoleMode( outHandle, &fdwMode) )
WriteConsoleW( outHandle, szwOut, wcslen(szwOut),
int nOutputCP = GetConsoleOutputCP();
int charCount = WideCharToMultiByte(nOutputCP, 0, szwOut, -1, 0,
0, 0, 0);
char* szaStr = (char*) malloc(charCount);
WideCharToMultiByte( nOutputCP, 0, szwOut, -1, szaStr, charCount,
WriteFile(outHandle, szaStr, charCount-1, &dwBytesWritten, 0);
Note WriteFile writes charCount-1 bytes to filter out the NULL terminator.