Fix wxRegEx::GetMatch() to work in WXREGEX_CONVERT_TO_MB case

Using the offset into the wide string doesn't work for non-ASCII
characters, it must be converted to UTF-8 first.
This commit is contained in:
Vadim Zeitlin 2021-07-15 22:26:58 +02:00
parent 3a52523f96
commit 838b693b46

View File

@ -906,7 +906,11 @@ wxString wxRegEx::GetMatch(const wxString& text, size_t index) const
if ( !GetMatch(&start, &len, index) )
return wxEmptyString;
#ifndef WXREGEX_CONVERT_TO_MB
return text.Mid(start, len);
#else
return wxString::FromUTF8(text.utf8_str().data() + start, len);
#endif
}
size_t wxRegEx::GetMatchCount() const