Mercurial > hg > isophonics-drupal-site
diff core/lib/Drupal/Component/Utility/Unicode.php @ 12:7a779792577d
Update Drupal core to v8.4.5 (via Composer)
author | Chris Cannam |
---|---|
date | Fri, 23 Feb 2018 15:52:07 +0000 |
parents | 4c8ae668cc8c |
children | 1fec387a4317 |
line wrap: on
line diff
--- a/core/lib/Drupal/Component/Utility/Unicode.php Fri Feb 23 15:51:18 2018 +0000 +++ b/core/lib/Drupal/Component/Utility/Unicode.php Fri Feb 23 15:52:07 2018 +0000 @@ -603,11 +603,13 @@ * * @param string $string * The header to encode. + * @param bool $shorten + * If TRUE, only return the first chunk of a multi-chunk encoded string. * * @return string * The mime-encoded header. */ - public static function mimeHeaderEncode($string) { + public static function mimeHeaderEncode($string, $shorten = FALSE) { if (preg_match('/[^\x20-\x7E]/', $string)) { // floor((75 - strlen("=?UTF-8?B??=")) * 0.75); $chunk_size = 47; @@ -616,6 +618,9 @@ while ($len > 0) { $chunk = static::truncateBytes($string, $chunk_size); $output .= ' =?UTF-8?B?' . base64_encode($chunk) . "?=\n"; + if ($shorten) { + break; + } $c = strlen($chunk); $string = substr($string, $c); $len -= $c;