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?