diff --git a/src/common/utilscmn.cpp b/src/common/utilscmn.cpp index b1f9ffed46..2206f3d895 100644 --- a/src/common/utilscmn.cpp +++ b/src/common/utilscmn.cpp @@ -613,14 +613,7 @@ static bool ReadAll(wxInputStream *is, wxArrayString& output) // the stream could be already at EOF or in wxSTREAM_BROKEN_PIPE state is->Reset(); - // Notice that wxTextInputStream doesn't work correctly with wxConvAuto - // currently, see #14720, so use the current locale conversion explicitly - // under assumption that any external program should be using it too. - wxTextInputStream tis(*is, " \t" -#if wxUSE_UNICODE - , wxConvLibc -#endif - ); + wxTextInputStream tis(*is); for ( ;; ) { diff --git a/tests/exec/exec.cpp b/tests/exec/exec.cpp index f350376043..bb82e4c059 100644 --- a/tests/exec/exec.cpp +++ b/tests/exec/exec.cpp @@ -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__