diff --git a/src/unit/engine/ArcanistXUnitTestResultParser.php b/src/unit/engine/ArcanistXUnitTestResultParser.php index d8649172..3e04b779 100644 --- a/src/unit/engine/ArcanistXUnitTestResultParser.php +++ b/src/unit/engine/ArcanistXUnitTestResultParser.php @@ -24,7 +24,9 @@ final class ArcanistXUnitTestResultParser { $load_success = @$xunit_dom->loadXML($test_results); if (!$load_success) { - $input_start = phutil_utf8_shorten($test_results, 150); + $input_start = id(new PhutilUTF8StringTruncator()) + ->setMaximumGlyphs(150) + ->truncateString($test_results); throw new Exception( "Failed to load XUnit report; Input starts with:\n\n {$input_start}"); } diff --git a/src/workflow/ArcanistDiffWorkflow.php b/src/workflow/ArcanistDiffWorkflow.php index e174b464..de3818ee 100644 --- a/src/workflow/ArcanistDiffWorkflow.php +++ b/src/workflow/ArcanistDiffWorkflow.php @@ -1509,7 +1509,9 @@ EOTEXT $preview = explode("\n", $saved); $preview = array_shift($preview); $preview = trim($preview); - $preview = phutil_utf8_shorten($preview, 64); + $preview = id(new PhutilUTF8StringTruncator()) + ->setMaximumGlyphs(64) + ->truncateString($preview); if ($preview) { $preview = "Message begins:\n\n {$preview}\n\n"; diff --git a/src/workflow/ArcanistFlagWorkflow.php b/src/workflow/ArcanistFlagWorkflow.php index 4bbe7ee3..2a7e06c2 100644 --- a/src/workflow/ArcanistFlagWorkflow.php +++ b/src/workflow/ArcanistFlagWorkflow.php @@ -88,7 +88,12 @@ EOTEXT // Make sure notes that are long or have line breaks in them or // whatever don't mess up the formatting. $note = implode(' ', preg_split('/\s+/', $note)); - $note = ' ('.phutil_utf8_shorten($note, 40, '...').')'; + $note = ' ('. + id(new PhutilUTF8StringTruncator()) + ->setMaximumGlyphs(40) + ->setTerminator('...') + ->truncateString($note). + ')'; } echo phutil_console_format( "%s flag%s $verb!\n",