currency symbol is not consistent in Visual Studio
-
I have the following code:
System.Globalization.CultureInfo ci = new System.Globalization.CultureInfo("en-US");
System.Threading.Thread.CurrentThread.CurrentCulture = ci;
System.Threading.Thread.CurrentThread.CurrentUICulture = ci;
Console.WriteLine("Currency symbol test {0:s} {1:c}", ci.NumberFormat.CurrencySymbol, 12.34M);
System.Diagnostics.Debug.WriteLine("Currency symbol test {0:s} {1:c}", ci.NumberFormat.CurrencySymbol, 56.78M);When running the program from a Command window, the currency symbol (24 hex) is correctly displayed in both instances, as follows: Currency symbol test $ $12.34 When running the program from VS (2010) debugger, the currency symbol (A4 hex) is incorrectly displayed when writing to the VS output window pane, as follows: Currency symbol test $ ¤56.78 My Windows 7 Region and Language settings are English and United States. The Currency Symbol is dollar sign ($). How can I force Visual Studio to recognize the current locale and output the correct currency symbol in the output window pane?
-
I have the following code:
System.Globalization.CultureInfo ci = new System.Globalization.CultureInfo("en-US");
System.Threading.Thread.CurrentThread.CurrentCulture = ci;
System.Threading.Thread.CurrentThread.CurrentUICulture = ci;
Console.WriteLine("Currency symbol test {0:s} {1:c}", ci.NumberFormat.CurrencySymbol, 12.34M);
System.Diagnostics.Debug.WriteLine("Currency symbol test {0:s} {1:c}", ci.NumberFormat.CurrencySymbol, 56.78M);When running the program from a Command window, the currency symbol (24 hex) is correctly displayed in both instances, as follows: Currency symbol test $ $12.34 When running the program from VS (2010) debugger, the currency symbol (A4 hex) is incorrectly displayed when writing to the VS output window pane, as follows: Currency symbol test $ ¤56.78 My Windows 7 Region and Language settings are English and United States. The Currency Symbol is dollar sign ($). How can I force Visual Studio to recognize the current locale and output the correct currency symbol in the output window pane?
-
I have the following code:
System.Globalization.CultureInfo ci = new System.Globalization.CultureInfo("en-US");
System.Threading.Thread.CurrentThread.CurrentCulture = ci;
System.Threading.Thread.CurrentThread.CurrentUICulture = ci;
Console.WriteLine("Currency symbol test {0:s} {1:c}", ci.NumberFormat.CurrencySymbol, 12.34M);
System.Diagnostics.Debug.WriteLine("Currency symbol test {0:s} {1:c}", ci.NumberFormat.CurrencySymbol, 56.78M);When running the program from a Command window, the currency symbol (24 hex) is correctly displayed in both instances, as follows: Currency symbol test $ $12.34 When running the program from VS (2010) debugger, the currency symbol (A4 hex) is incorrectly displayed when writing to the VS output window pane, as follows: Currency symbol test $ ¤56.78 My Windows 7 Region and Language settings are English and United States. The Currency Symbol is dollar sign ($). How can I force Visual Studio to recognize the current locale and output the correct currency symbol in the output window pane?
using .NET Reflector I checked what really is done and
System.Diagnostics.Debug.WriteLine()
explicitly usesCultureInfo.InvariantCulture
for its internal call tostring.Format()
. If you really need the debug output to use some other culture, then you'll need to callstring.Format()
yourself.