


public static byte[] ConvertAsciiToEbcdic(byte[] asciiData)
{
// Create two different encodings.
Encoding ascii = Encoding.ASCII;
Encoding ebcdic = Encoding.GetEncoding("IBM037"); //Retutn Ebcdic Data
return Encoding.Convert(ascii, ebcdic, asciiData);
}
public static byte[] ConvertEbcdicToAscii(byte[] ebcdicData)
{
// Create two different encodings.
Encoding ascii = Encoding.ASCII;
Encoding ebcdic = Encoding.GetEncoding("IBM037"); //Retutn Ascii Data
return Encoding.Convert(ebcdic, ascii, ebcdicData);
} 

Encoding ascii = Encoding.ASCII;
ASCII might not be appropriate. UTF8Encoding might be better. The ASCII character set might not include everything.
Encoding ebcdic = Encoding.GetEncoding(“IBM037″);
IBM037 should work for US English encoding. However, if this is DBCS or some more involved encoding, the 037 set probably won’t work correctly. The actual encoding will need to be known. The encoding should either be sent with the file or data, or it should be agreed upon by the two sides of a conversation.
Be aware that some cooperation may be needed between sending and receiving side. Practically speaking, an encoding such as UTF8 ought to be agreed upon by both sides before exchange of data. Sending encoded data without advertising the encoding scheme gets real messy.
Tom
i have 2 textBoxes and 1 button.
textbox1 has Ebcdis code
i want that when i click on button
textBox2 shows ascii code
how will i do that???
That’s helpful Tom. I was wondering about this as well.