The Linux Currency Symbol

March 17, 2020
linux globalization

What does the USD symbol look like in Linux? The unknown emoji symbol, kinda.

As I foray more and more into Linux teriitory, I find fun and interesting differences between Windows and Linux. The first thing was time zones. But who cares that was kind of expected.

But now? the USD symbol. It;s not surprising to people that are intimately familiar with System.Globalization, I imagine. But for those of where the default current culture setting was working great, this one is odd.

Money. en-US, money = $.

But, for NumberFormatInfo.CurrencySymbol, the docs say: "The string to use as the currency symbol. The default for InvariantInfo is "¤"."

Which is weird, because on every server and desktop I have ever run on the default is "$."

But not on Linux. On Linux it's the real default. The ¤.

Easy fix? Yes. On start up:

            var cultureInfo = new CultureInfo("en-US");

            cultureInfo.NumberFormat.CurrencySymbol = "$";

 

            CultureInfo.DefaultThreadCurrentCulture = cultureInfo;

            CultureInfo.DefaultThreadCurrentUICulture = cultureInfo;