// STEP 1
// read original unrecognized file with
Encoding ecp862 = Encoding.GetEncoding(862);
StreamReader sr862 = new StreamReader(openFileDialog1.FileName, ecp862, true);
txtText01.Text = sr862.ReadToEnd();
sr862.Close();
// END STEP 1
// METHOD 1 FOR STEP 2
// copy to txt file
StreamWriter sr = new StreamWriter(@"c:\\temp\\ecp862.txt");
sr.Write(txtText01.Text);
sr.Close();
// reading txt file
Encoding ecp28598 = Encoding.GetEncoding(28598);
StreamReader sr28598 = new StreamReader(@"c:\\temp\\ecp862.txt", ecp28598, true);
txtText02.Text = sr28598.ReadToEnd();
sr28598.Close();
// END METHOD 1
// METHOD 2 FOR STEP 2
Encoding ecp28598_2 = Encoding.GetEncoding(28598);
// Convert the string into a byte[].
byte[] ecp862Bytes = ecp862.GetBytes(txtText01.Text);
// Perform the conversion from one encoding to the other.
byte[] code28598Bytes = Encoding.Convert(ecp862, ecp28598_2, ecp862Bytes);
//Convert the new byte[]into a char[] and then into a string
char[] code28598Chars = new char[ecp28598_2.GetCharCount(code28598Bytes, 0, code28598Bytes.Length)];
ecp28598_2.GetChars(code28598Bytes, 0, code28598Bytes.Length, code28598Chars, 0);
string code28598String = new string(code28598Chars);
txtText03.Text = code28598String;
// END METHOD 2