Skip to content

Commit

Permalink
Fix number trim in case of multibyte characters
Browse files Browse the repository at this point in the history
  • Loading branch information
czigor committed Nov 21, 2018
1 parent 6514870 commit b7c39c4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Formatter/CurrencyFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit b7c39c4

Please sign in to comment.