问题
i have this code when i run it, it give me "?" instead of "€" (euro sign). Can anyone tell me what i can do to fix it.
string Message = "Hello $ € £";
Encoding iso = Encoding.GetEncoding("ISO-8859-1");
Encoding utf8 = Encoding.UTF8;
byte[] utfBytes = utf8.GetBytes(Message);
byte[] isoBytes = Encoding.Convert(utf8, iso, utfBytes);
string msg = iso.GetString(isoBytes);
Console.WriteLine(msg);
回答1:
string Message = "Hello $ € £";
Console.OutputEncoding = Encoding.UTF8;
Console.WriteLine(Message);
I just confirmed this works, but you also need to use the right font for your console (for example I tried "Lucida Console" which is OK. also, you also need to make sure your source code (.cs file or whatever) is in utf8 encoding.

回答2:
Please refer to the URL http://www.cs.tut.fi/~jkorpela/html/euro.html it shows all methods for encoding.
回答3:
The euro sign is not a part of the ISO-8859-1 character set: http://en.wikipedia.org/wiki/ISO/IEC_8859-1#Codepage_layout (the pound sign does appear there)
来源:https://stackoverflow.com/questions/13373925/encoding-issue-of-euro-sign