Windows Server 2012 has invalid decimal digits for currency in es-CL culture

In Windows Server 2012, there seem to be a few issues regarding CultureInfo. Information about decimal places for currencies in the es-CL culture (this is Chile) is incorrect, it says 2 digits, but here in Chile we do not use decimal places in our currency.

Does anyone know about a patch, or perhaps a way to override this parameter? Changing Windows Locale settings does not work for me because I need this to work on the MVC 5 site.

Any help would be greatly appreciated.

PS: I never had this problem with my dev machine (I use from Win7 to 10), so I assume that this problem only exists in Windows Server 2012

0
source share
2 answers

Gabriel will check this configuration and try.

https://i.stack.imgur.com/C0A4d.png

0
source

First of all, let me tell you that this is not what I need, but I will leave it here if someone else needs a patch for this.

One option is to “fix” the source code to override the number of decimal digits used in currencies (you can override all the properties you want). To do this, you need to create a specific culture, using the one you want to redefine as the base:

culture = CultureInfo.CreateSpecificCulture("es-CL");
culture.NumberFormat.CurrencyDecimalDigits = 0;

And then assign this culture variable to Current Thread:

Thread.CurrentThread.CurrentCulture = culture;

, MVC , "ActionFilterAttribute", :

public class LocalizationFilter : ActionFilterAttribute
{
    public override void OnActionExecuting(ActionExecutingContext filterContext)
    {
        CultureInfo culture = CultureInfo.CreateSpecificCulture("es-CL");
        culture.NumberFormat.CurrencyDecimalDigits = 0;
        Thread.CurrentThread.CurrentCulture = culture;
    }
}

, Global.asax :

GlobalFilters.Filters.Add(new LocalizationFilter());
0

All Articles