Reimplement wxSafeConvertXXX() functions using wxWhateverWorksConv

These functions were almost but not quite identical to it:
wxSafeConvertMB2WX() tried the current locale encoding before UTF-8 while
wxConvWhateverWorks tries UTF-8 first and then the current locale encoding.

The latter behaviour is more correct as valid UTF-8 could be misinterpreted as
some legacy multibyte encoding otherwise, so get rid of this difference and
just forward these functions to wxConvWhateverWorks.
This commit is contained in:
Vadim Zeitlin
2016-02-19 02:57:20 +01:00
parent 8eac125e86
commit 956edbb309
2 changed files with 8 additions and 35 deletions

View File

@@ -3320,36 +3320,6 @@ wxWhateverWorksConv::FromWChar(char *dst, size_t dstLen,
return rc;
}
#if wxUSE_UNICODE
wxWCharBuffer wxSafeConvertMB2WX(const char *s)
{
if ( !s )
return wxWCharBuffer();
wxWCharBuffer wbuf(wxConvLibc.cMB2WX(s));
if ( !wbuf )
wbuf = wxConvUTF8.cMB2WX(s);
if ( !wbuf )
wbuf = wxConvISO8859_1.cMB2WX(s);
return wbuf;
}
wxCharBuffer wxSafeConvertWX2MB(const wchar_t *ws)
{
if ( !ws )
return wxCharBuffer();
wxCharBuffer buf(wxConvLibc.cWX2MB(ws));
if ( !buf )
buf = wxConvUTF8.cWX2MB(ws);
return buf;
}
#endif // wxUSE_UNICODE
// ----------------------------------------------------------------------------
// globals
// ----------------------------------------------------------------------------