2009-08-26 18 views
2

私はlog4netを使って書式付きメッセージを出力しています。次のコードString.Formatとlog.DebugFormat通貨

log.DebugFormat("Balance: {0:c} ", balance); 

結果「バランス:¤1,000.00」

はなぜ奇妙なキャラクターが、私はとは何かであることを想像$

+1

はあなたのコンピュータ上の領域の設定を確認しましたか? – Stephan

+0

どこにログインしていますか? –

+0

私は実際にはlog4netと関係があると思います、これは期待どおりに動作するからです。 log.Debug(String.Format( "残高:{0:C}"、残高)); – Striker

答えて

1

出現していませんあなたの地域の設定。

このような何か試してみてください:

System.Threading.Thread.CurrentThread.CurrentCulture.NumberFormat:そのdosen'tの仕事は、あなたはいつもの価値を確認するために、デバッガを使用できる場合

System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo(<your culture setting>); 
log.DebugFormat("Balance: {0:c} ", balance); 

を;それは「$」記号に設定されますことを確認するために

ansiCurrencySymbol 

は、具体的の値を確認します。

ます。また、このウィキペディアのページでinterstedてすることができる:http://en.wikipedia.org/wiki/Currency_%28typography%29あなたが取得しているシンボルが何であるかを説明し

は、具体的に:

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 &curren; or numeric character reference &#164; may be used. 
+0

それを試して、同じ結果を得ました – Striker