Merge branch 'utf8-text-stream'

Really fix reading from UTF-8 text streams.

Closes #14720.

See https://github.com/wxWidgets/wxWidgets/pull/1304
This commit is contained in:
Vadim Zeitlin
2019-05-10 01:35:55 +02:00
6 changed files with 87 additions and 10 deletions

View File

@@ -516,3 +516,28 @@ void ExecTestCase::TestOverlappedSyncExecute()
CPPUNIT_ASSERT_EQUAL( SLEEP_END_STRING, longSleepOutput.Last() );
#endif // !__WINDOWS__
}
#ifdef __UNIX__
// This test is disabled by default because it must be run in French locale,
// i.e. with explicit LC_ALL=fr_FR.UTF-8 and only works with GNU ls, which
// produces the expected output.
TEST_CASE("wxExecute::RedirectUTF8", "[exec][unicode][.]")
{
wxArrayString output;
REQUIRE( wxExecute("/bin/ls --version", output) == 0 );
for ( size_t n = 0; n < output.size(); ++n )
{
// It seems unlikely that this part of the output will change for GNU
// ls, so check for its presence as a sign that the program output was
// decoded correctly.
if ( output[n].find(wxString::FromUTF8("vous \xc3\xaates libre")) != wxString::npos )
return;
}
INFO("output was:\n" << wxJoin(output, '\n'));
FAIL("Expected output fragment not found.");
}
#endif // __UNIX__