开发者

Getting generic currency sign instead of $ in .NET application

开发者 https://www.devze.com 2023-03-23 21:17 出处:网络
In our VB .NET application, we use \"c0\" and \"c2\" format strings to display开发者_JAVA百科 currency values all over the place.

In our VB .NET application, we use "c0" and "c2" format strings to display开发者_JAVA百科 currency values all over the place.

Recently, users have had issues where these currency values don't show up correctly with a $ sign, but with some weird symbol, ¤. Through wikipedia, I found out it's the generic currency symbol: http://en.wikipedia.org/wiki/Currency_(typography)

I've seen the problem happen on my machine ONCE, and haven't been able to recreate it since. It went away when I restarted the application. In fact, as soon as I saw the problem, I started another instance of the application but $ signs showed up fine in that second instance.

I'd appreciate any insights on how to fix this weird issue.


We finally got hold of a build where this problem happened consistently.

Turned out, we use RedGate SQL Compare to compare and update users' databases, and it was a bug in RedGate that changed our Globalization.CultureInfo.CurrentCulture from "en-US" to "". That in turns changed the Globalization.CultureInfor.CurrentCulture.NumberFormat.CurrencySymbol to the generic sign ¤.

I'm still unclear as to why the issue happened with some databases and not others, but we've certainly found our workaround.

The RedGate problem was identified in this forum thread: http://www.red-gate.com/messageboard/viewtopic.php?t=10864 and has been fixed since their March 2011 release


You may need to explicitly set the format locale before using your format strings.

0

精彩评论

暂无评论...
验证码 换一张
取 消