[Tutor] trying to translate and ebcidic file
Steve Willoughby
steve at alchemy.com
Tue Jun 14 21:13:22 CEST 2011
On 14-Jun-11 11:40, Prinn, Craig wrote:
> I am looking for a way to translate and ebcidic file to ascii. Is there
> a pre-existing library for this, or do I need to do this from scratch?
> If from scratch and ideas on where to start?
Bear in mind that there's no 100% straight-across translation, because
ASCII and EBCDIC each has characters that the other lacks. However, to
translate the character codes they share in common, you could do
something as simple as using the translation table functionality built
in to the string class in Python, setting up a table to convert between
one and the other.
of course, if you are on a Unix-like system, there's already a command
for that, to convert a file "E" from EBCDIC to a file "A" in ASCII:
$ dd if=E of=A conv=ascii
or the other way:
$ dd if=A of=E conv=ebcdic
--
Steve Willoughby / steve at alchemy.com
"A ship in harbor is safe, but that is not what ships are built for."
PGP Fingerprint 4615 3CCE 0F29 AE6C 8FF4 CA01 73FE 997A 765D 696C
More information about the Tutor
mailing list