0

I have a string contained in an array as follows:

array(1) { [0]=> string(11) "€5,000.00" }

When displaying the string, it is malformed:

enter image description here

Page charset is set to:

 <meta charset="utf-8">

EDIT

To add more detail to this questions, this is how the string is being created:

    $numberFormatter = new \NumberFormatter('en_US', \NumberFormatter::CURRENCY);
    $moneyFormatter = new IntlMoneyFormatter($numberFormatter, $currencies);
    $moneyFormatter->format(new Money($balance['amount'], $currency));

where new Money is the moneyphp class...

HappyCoder
  • 5,985
  • 6
  • 42
  • 73
  • All it takes, is one wrong charset setting in your application - *everything* needs to be the same charset! I have previously written [**an answer about UTF-8 encoding**](https://stackoverflow.com/a/31899827/4535200) that contains a little checklist, that will cover *most* of the charset issues in a PHP/MySQL application. There's also a more in-depth topic, [**UTF-8 All the Way Through**](https://stackoverflow.com/q/279170/4535200). Most likely, you'll find a solution in either one or both of these topics. – Qirel Jul 24 '19 at 09:35
  • hmm... seems this is something else. When the EUR sign is used in a drop down menu, it is being malformed. BUT when it is used in a normal view... it shows as expected... – HappyCoder Jul 24 '19 at 13:26
  • It's most likely due to a broken charset, so depends where it comes from. If the dropdown comes from a DB for example, the entire pipeline and data itself in the DB must be of the same charset. – Qirel Jul 24 '19 at 14:08
  • Added an edit with more details. – HappyCoder Jul 24 '19 at 15:16

0 Answers0