Dear All,
Good Day
I am trying to convert a file which is generated on AS400 with codepage 00420 (arabic & English data combination) with no success. But using the same code( and changing 20420 to 708) I am able to convert a file from codepage ASMO 708 to windows based file and it is perfect. The following is the code I tried. i used 20420 codepage which is the nearest match for 00420. but no luck.
//Open file for reading and set encoding to 20420
StreamReader sr = new StreamReader((System.IO.Stream)File.OpenRead(strIn File ), Encoding.GetEncoding(20420));
//Openfile to write and set encoding to default
StreamWriter sw = new StreamWriter(strOutFile, false, Encoding.Default);
and I read the input file line by line and then write each line to the output file
//Read line
Line = sr.ReadLine();
//Loop logic here and then write to file
//Write line
sw.WriteLine(Line );
I verfied in windows regional settings to make sure that codepage 20420 is checked. Still I am not able to convert the file. The output is full of questions marks, which i belive is because it didnt recognize the character.
Anyone please help me to solve this issue.
Thanks in advance
Ram