Switch to fallback earlier if the input is not valid UTF-8 prefix

This commit is contained in:
Pavel Tyunin
2020-09-29 15:35:53 +03:00
parent bc838b4773
commit b3eff48e28
4 changed files with 25 additions and 4 deletions

View File

@@ -288,9 +288,8 @@ void ConvAutoTestCase::StreamUTF32BE()
void ConvAutoTestCase::StreamFallback()
{
// this only works if there are at least 3 bytes after the first non-ASCII character
TestTextStream("\x61\xbf\x0A\xe0\x7a",
5, wxString::FromUTF8("a\xd0\x9f"), wxString::FromUTF8("\xd1\x80z"),
TestTextStream("\x61\xbf\x0A\xe0",
4, wxString::FromUTF8("a\xd0\x9f"), wxString::FromUTF8("\xd1\x80"),
wxFONTENCODING_ISO8859_5);
}