Hello guys for example when I open with notepad a text file it’s shows for example this characters (for me is ok this output)
"ÍÜÞ ËÀÉÍ ÑÈÍÅÌÀ"
"ÕÅÐÎÍ ÊÎÌÌÜÞÍÈÊÅÉØÍÇ"
But when I trying to read it with C#
OpenFileDialog ofd = new OpenFileDialog();
if (ofd.ShowDialog() == DialogResult.OK)
{
text = File.ReadAllText(ofd.FileName);
textBox1.Text = text;
}
It shows
"��� ���� ������"
"����� ��������������"
You need to pass the right encoding to
File.ReadAllText:However, you’ll need to either know the encoding beforehand, or work it out with heuristics (there’ll always be a chance you’ll get the wrong one).
For your real use case, do you know what the encoding will be?