git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@29095
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
size_t MB2WC(wchar_t *buf, const char *psz, size_t n) const
{
size_t MB2WC(wchar_t *buf, const char *psz, size_t n) const
{
+ // note that we have to use MB_ERR_INVALID_CHARS flag as it without it
+ // the behaviour is not compatible with the Unix version (using iconv)
+ // and break the library itself, e.g. wxTextInputStream::NextChar()
+ // wouldn't work if reading an incomplete MB char didn't result in an
+ // error
const size_t len = ::MultiByteToWideChar
(
m_CodePage, // code page
const size_t len = ::MultiByteToWideChar
(
m_CodePage, // code page
+ MB_ERR_INVALID_CHARS, // flags: fall on error
psz, // input string
-1, // its length (NUL-terminated)
buf, // output string
psz, // input string
-1, // its length (NUL-terminated)
buf, // output string