Background:
- I have a table in SQL database, two of the columns are English names and Simplified Chinese names.
- With C#, I had records of this table displayed as buttons with both names, such as: Car车. This is how I did it:
button.Text = x.EnglishName + x.ChineseName;
The buttons displays correctly.
3.I would like to compare button.Text to other strings, like so:
for (int K = 0; K < alist.Count; K++)
{
string alpha = alist.[K];
if (alpha == button.Text)
//blahblahblah
}
Problem:
There is always an error.
And I found out why: when I use Console.Writeline(button.Text)
, the output is Car?.
Each Chinese character is turned into a "?"
So, apparently, writing Chinese characters onto the face of a button is fine. But when reading Chinese characters off the face of a button does not work.
How do I correct this?