diff --git a/include/wx/string.h b/include/wx/string.h index d95710424d..fe6394dbe5 100644 --- a/include/wx/string.h +++ b/include/wx/string.h @@ -4030,9 +4030,7 @@ namespace std WXDLLIMPEXP_BASE wxSTD ostream& operator<<(wxSTD ostream&, const wxString&); WXDLLIMPEXP_BASE wxSTD ostream& operator<<(wxSTD ostream&, const wxCStrData&); WXDLLIMPEXP_BASE wxSTD ostream& operator<<(wxSTD ostream&, const wxScopedCharBuffer&); -#ifndef __BORLANDC__ WXDLLIMPEXP_BASE wxSTD ostream& operator<<(wxSTD ostream&, const wxScopedWCharBuffer&); -#endif #if wxUSE_UNICODE && defined(HAVE_WOSTREAM) diff --git a/src/common/string.cpp b/src/common/string.cpp index d2bcac8b03..7f0a657366 100644 --- a/src/common/string.cpp +++ b/src/common/string.cpp @@ -207,12 +207,14 @@ wxSTD ostream& operator<<(wxSTD ostream& os, const wxScopedCharBuffer& str) return os << str.data(); } -#ifndef __BORLANDC__ wxSTD ostream& operator<<(wxSTD ostream& os, const wxScopedWCharBuffer& str) { - return os << str.data(); + // There is no way to write wide character data to std::ostream directly, + // but we need to define this operator for compatibility, as we provided it + // since basically always, even if it never worked correctly before. So do + // the only reasonable thing and output it as UTF-8. + return os << wxConvWhateverWorks.cWC2MB(str.data()); } -#endif #if wxUSE_UNICODE && defined(HAVE_WOSTREAM)