From 6d661aa4d8a15170af4bebb684508fa50f9de10f Mon Sep 17 00:00:00 2001 From: Tyson Andre Date: Sun, 14 Jul 2019 14:44:46 -0400 Subject: [PATCH] Check for Windows utf-8 support in run-tests.php Windows terminals can have different codepages. In some locales (especially in older OS versions), the default codepage isn't necessarily utf-8. Non-utf8 codepages wouldn't render this utf-8 character properly. --- run-tests.php | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/run-tests.php b/run-tests.php index f54dc2d37a6a..968d424d5359 100755 --- a/run-tests.php +++ b/run-tests.php @@ -1351,9 +1351,17 @@ function run_all_tests_parallel($test_files, $env, $redir_tested) { $workerProcs = []; $workerSocks = []; - echo "====⚡️===========================================================⚡️====\n"; - echo "====⚡️==== WELCOME TO THE FUTURE: run-tests PARALLEL EDITION ====⚡️====\n"; - echo "====⚡️===========================================================⚡️====\n"; + $c = "⚡️"; + if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { + if (!function_exists('sapi_windows_cp_is_utf8') || !sapi_windows_cp_is_utf8()) { + // This is Windows, and the terminal (probably) doesn't support UTF-8. Use a different character instead. + $c = "x"; + } + } + + echo "====$c===========================================================$c====\n"; + echo "====$c==== WELCOME TO THE FUTURE: run-tests PARALLEL EDITION ====$c====\n"; + echo "====$c===========================================================$c====\n"; // Each test may specify a list of conflict keys. While a test that conflicts with // key K is running, no other test that conflicts with K may run. Conflict keys are