From b7c39c488005d792506ee3ec134bcbd86795dcd8 Mon Sep 17 00:00:00 2001 From: czigor Date: Wed, 21 Nov 2018 13:04:29 +0100 Subject: [PATCH] Fix number trim in case of multibyte characters --- src/Formatter/CurrencyFormatter.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Formatter/CurrencyFormatter.php b/src/Formatter/CurrencyFormatter.php index 8d4d11f2..807d4fa0 100644 --- a/src/Formatter/CurrencyFormatter.php +++ b/src/Formatter/CurrencyFormatter.php @@ -117,8 +117,8 @@ public function format($number, $currencyCode, array $options = []) $number = str_replace('¤', $currency->getCurrencyCode(), $number); } else { // No symbol should be displayed. Remove leftover whitespace. - $number = str_replace('¤', '', $number); - $number = trim($number, " \xC2\xA0"); + $pattern = '/^\s+|\s*¤*$/us'; + $number = preg_replace($pattern, '', $number); } return $number;