|
@@ -401,6 +401,7 @@ void Print(const wchar_t* Message)
|
|
|
//---------------------------------------------------------------------------
|
|
|
void Print(bool FromBeginning, const wchar_t* Message)
|
|
|
{
|
|
|
+ size_t Len = wcslen(Message);
|
|
|
if ((OutputType == FILE_TYPE_DISK) || (OutputType == FILE_TYPE_PIPE))
|
|
|
{
|
|
|
if (FromBeginning && (Message[0] != L'\n'))
|
|
@@ -434,7 +435,24 @@ void Print(bool FromBeginning, const wchar_t* Message)
|
|
|
{
|
|
|
WriteConsole(ConsoleOutput, L"\r", 1, &Written, NULL);
|
|
|
}
|
|
|
- WriteConsole(ConsoleOutput, Message, wcslen(Message), &Written, NULL);
|
|
|
+ bool WriteResult =
|
|
|
+ WriteConsole(ConsoleOutput, Message, Len, &Written, NULL);
|
|
|
+ int Error = GetLastError();
|
|
|
+ // The current console font does not support some characters in the message,
|
|
|
+ // fall back to ansi-writting
|
|
|
+ if (!WriteResult && (Error == ERROR_GEN_FAILURE))
|
|
|
+ {
|
|
|
+ int Size = WideCharToMultiByte(CP_ACP, 0, Message, -1, 0, 0, 0, 0);
|
|
|
+ if (Size > 0)
|
|
|
+ {
|
|
|
+ char* Buffer = new char[Size];
|
|
|
+ if (WideCharToMultiByte(CP_ACP, 0, Message, -1, Buffer, Size, 0, 0) > 0)
|
|
|
+ {
|
|
|
+ WriteConsoleA(ConsoleOutput, Buffer, strlen(Buffer), &Written, NULL);
|
|
|
+ }
|
|
|
+ delete[] Buffer;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
//---------------------------------------------------------------------------
|