128 isn't the correct value to represent the Euro sign. Maybe try:
string input = ((char)0x20AC).ToString();
Because U+20AC
is the Unicode code-point for a Euro sign.
Pregunta
I am trying to print the Euro Symbol in my Windows forms application with the following code. It works for all other characters & symbols, but Euro(€) is not displaying.
string input = ((char)128).ToString();
Font f = new System.Drawing.Font("Arial", 12f);
Graphics gr = this.CreateGraphics();
gr.DrawString(input, f, Brushes.Black, new PointF(0, 0));
128 - is the decimal of Euro sign Can anyone help on this?
Solución
128 isn't the correct value to represent the Euro sign. Maybe try:
string input = ((char)0x20AC).ToString();
Because U+20AC
is the Unicode code-point for a Euro sign.
Otros consejos
By using the below code, I achieved printing Euro symbol without using unicode of it.
String input = Encoding.Default.GetString(new byte[] { 128 });
Font f = new System.Drawing.Font("Arial", 12f);
Graphics gr = this.CreateGraphics();
gr.DrawString(input, f, Brushes.Black, new PointF(0, 0));
This may help someone.