Brad
Brad

Reputation: 10660

Blazor displays ¤ instead of $ when using ToString("C")

I'm building a Blazor Web app (wasm). I use ToString("C") to display values as a currency, however the dollar sign is showing up as ¤, for example ¤4.83 instead of $4.83. According to Wikipedia "The currency sign ¤ is a character used to denote an unspecified currency"

This seems like a localization issue, but my browser / Blazor is not detecting that I'm en-US and showing the $ sign. How can I show the correct currency symbol?

I'm currently using .Net 5, but this problem exists on .Net core 3.x as well.

Upvotes: 3

Views: 1242

Answers (1)

Brian Parker
Brian Parker

Reputation: 14533

Add this to startup. I only saw this behaviour when I switched to (WSL 2)

CultureInfo.DefaultThreadCurrentCulture = new CultureInfo("en-US");

Upvotes: 8

Related Questions