commerceguys / intl

A PHP internationalization library, powered by CLDR data.
MIT License
361 stars 45 forks source link

Fix number trim in case of multibyte characters #72

Open czigor opened 6 years ago

czigor commented 6 years ago

As discussed in https://www.drupal.org/project/commerce/issues/2936294, trim() only works for ASCII and does not work on multibyte utf8 characters. Let's use a preg_replace() instead.

czigor commented 6 years ago

@bojanz Added a test that fails without the fix. For this I needed a custom NumberFormatRepository, which I'm not sure how to include in the test.

czigor commented 6 years ago

The remaining test failure happens in master too.

czigor commented 6 years ago

The failing test was my bad, fixed it too.