String.Format and log.DebugFormat Currency
1 answer
I would guess it has something to do with your regional settings.
Try something like this:
System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo(<your culture setting>);
log.DebugFormat("Balance: {0:c} ", balance);
If that doesn't work, you can always use the debugger to check the value:
System.Threading.Thread.CurrentThread.CurrentCulture.NumberFormat;
Specifically check the value:
ansiCurrencySymbol
To make sure it is set to the $ symbol.
You may also be interested in this Wikipedia page: http://en.wikipedia.org/wiki/Currency_%28typography%29
This explains what character you are getting.
In particular:
The currency sign (¤) is a character used to denote a currency, when the symbol for a particular currency is unavailable.
It is particularly common in place of symbols, such as that of the Colón (₡), which are absent from most character sets and fonts.
It can be described as a circle the size of a lowercase character with four short radiating arms at 45° (NE), 135° (NW), 225°, (SW) and 315° (SE). It is slightly raised over the baseline.
It is represented in Unicode, as CURRENCY SIGN (U+00A4). In HTML, the character entity reference ¤ or numeric character reference ¤ may be used.
+1
source to share