Doesn't C# support EBCDIC encoding?

I'm working on a project that involves parsing Xerox Metacode print streams, encoded as variable-byte EBCDIC records. The print stream data itself is in ASCII, but the record headers and control records are in EBCDIC.

I read the records in as byte arrays. I know I can convert a byte array into an ASCII string:

Encoding ascii = Encoding.ASCII;
char[] asciiChars;
string asciiString;

record = new Byte[record_size];
count = infile.Read(record,0,record_size);
asciiChars = new char[ascii.GetCharCount(record, 0, record.Length)];
ascii.GetChars(record, 0, record.Length, asciiChars, 0);
asciiString = new string(asciiChars);

Obviously not all the code is there, but that's enough to show the technique. I need to do the same thing with records I know are in EBCDIC, yet System.Text.Encoding doesn't have EBCDIC!?

Any idea how to turn a byte array into a string, using EBCDIC encoding?

11 Years
Discussion Span
Last Post by tgreer
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.