EBCDIC to ASCII

  • Thread starter Thread starter Chris H.
  • Start date Start date
Chris H. said:
Is there an easy way to convert a string that is in EBCDIC to ASCII
Assuming that your EBCDIC is codepage 37

System.Text.Decoder EBCDICDecoder =
System.Text.Encoding.GetEncoding(37).GetDecoder();

Decoder.GetChars will decode an EBCDIC byte array into a .NET string. From
there you can use the ASCII encoder to encode the .NET string into a byte
array as ASCII.

Other EBCDIC code pages are listed here:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/intl/unicode_81rn.asp


David
 
Awww, c'mon, you can't invest in one of those monster IBM mainframes
anymore? Just think how nice and warm it would keep the house if you stored
it in the basement... ;-)

--
Kyril


| > After a quick Google
| >
search(http://www.google.com/search?hl=en&lr=&ie=UTF-8&q=EBCDIC++to+ASCII+C#),
| > I found this link:
| >
| > http://www.yoda.arachsys.com/csharp/ebcdic/
| >
| > (Leave it to Jon Skeet to master this... lol)
| >
| > Great work Jon! :-)
|
| Shame it turned out to be unnecessary, as there are standard code pages
| for EBCDIC. Still, it was fun - especially given that I'll probably
| never use a machine which uses EBCDIC :)
|
| --
| Jon Skeet - <[email protected]>
| http://www.pobox.com/~skeet
| If replying to the group, please do not mail me too
 
Kyril Magnos said:
Awww, c'mon, you can't invest in one of those monster IBM mainframes
anymore? Just think how nice and warm it would keep the house if you stored
it in the basement... ;-)

And how cool you'd stay in the summer if you rerouted its dedicated AC
upstairs :-)
 
lmao

--
HTH

Kyril Magnos
"I'm not a developer anymore, I'm a software engineer now!" :-)

|
| | > Awww, c'mon, you can't invest in one of those monster IBM mainframes
| > anymore? Just think how nice and warm it would keep the house if you
| stored
| > it in the basement... ;-)
|
| And how cool you'd stay in the summer if you rerouted its dedicated AC
| upstairs :-)
|
|
 
Jon said:
search(http://www.google.com/search?hl=en&lr=&ie=UTF-8&q=EBCDIC++to+ASCII+
C%23),

Shame it turned out to be unnecessary, as there are standard code
pages for EBCDIC. Still, it was fun - especially given that I'll
probably never use a machine which uses EBCDIC :)

Some time ago, while doing a Win XP installation to resurrect a friend's
installation, I realized that you can actually choose which code pages are
to be installed. I don't remember if the EBCDIC CPs where on the default
list, so your code may still be useful ;-)

Cheers,
 
Back
Top