Pound Sterling as Currency Code not rendering

SOS Childrensvillages asked on November 16, 2017 11:08

Hi,
we have "English - United Kingdom" as our site culture and want to use the "£" to format our currency strings like so: {0:0.00} £.

However, this renders out as 21.50 & #163; (without the space). This is not an issue with other symbols such as $ or €.
We're calling it with ShoppingCartInfo.GetFormattedPrice(n, true).

As a last resort I tried updating the UI to en-GB but it said I needed to download the language pack but there are no English language packs available at https://devnet.kentico.com/download/localization-packs.

We're on Kentico10 v10.0.27.

Thanks in advance

Correct Answer

SOS Childrensvillages answered on November 17, 2017 17:33

SOLUTION

Angular (1.6.6) was not trusting the HTML. My solution was to use ng-bind-html with $sce.trustAsHtml and ngSanitize

0 votesVote for this answer Unmark Correct answer

Recent Answers


Matt Nield answered on November 16, 2017 12:04

It's very odd, it looks like the output is being HTML encoded. Are you doing this in transformations, you could try using CurrencyInfoProvider.GetFormattedPrice(). If that doesn't help, can you tell us how/where ther error occurs (transformation, template, web part, or MVC etc)?

As a side not, GBP normally formats as £ {0:0.00} rather than having the currency symbol at the end.

0 votesVote for this answer Mark as a Correct answer

SOS Childrensvillages answered on November 16, 2017 13:47

Hi Matt, the issue seems to be in Kentico itself. When I debug the call to ShoppingCartInfo.GetFormattedPrice() in my code behind it gives me the encoded HTML as a result.

CurrencyInfoProvider.GetFormattedPrice(n,n,false) gave me £. CurrencyInfoProvider.GetFormattedPrice(n,n,true) gave me the encoded output.

So it is a matter of the the methods doing the encoding. However, ShoppingCartInfo.GetFormattedPrice doesn't have an overload to not encode the output (which works fine for euro and dollar anyway).

I switched the currency to euro and ShoppingCartInfo.GetFormattedPrice doesn't encode the result, it actually outputs a euro symbol.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.