Don't lose Unicode data in wxMessageOutputStderr

Ensure that we do output the string contents even if we have to encode it in
UTF-8 instead of the current locale encoding -- this is still better than not
outputting anything at all.

Closes #17358.
This commit is contained in:
Vadim Zeitlin
2016-02-19 02:34:20 +01:00
parent 3bb98963fa
commit fa8a482593

View File

@@ -148,13 +148,8 @@ wxString wxMessageOutputStderr::AppendLineFeedIfNeeded(const wxString& str)
void wxMessageOutputStderr::Output(const wxString& str) void wxMessageOutputStderr::Output(const wxString& str)
{ {
const wxString strWithLF = AppendLineFeedIfNeeded(str); const wxString strWithLF = AppendLineFeedIfNeeded(str);
const wxWX2MBbuf buf = strWithLF.mb_str();
if ( buf )
fprintf(m_fp, "%s", (const char*) buf);
else // print at least something
fprintf(m_fp, "%s", (const char*) strWithLF.ToAscii());
fprintf(m_fp, "%s", (const char*) strWithLF.mb_str(wxConvWhateverWorks));
fflush(m_fp); fflush(m_fp);
} }