Python

 View Only

 Availability of codec for decoding CCSID 01153?

Milan Otajovic's profile image
Milan Otajovic posted 06/15/26 11:53 AM

Does anyone know if there is codec available in z/OS Python 3.13/3.14 supporting  EBCDIC files encoded in CCSID 1153 (East European Latin2 EBCDIC w/Euro sign)? 

This code does not work:

with open(ebcdic_file, mode='r', encoding='cp1153') as source:
    content = source.read()

and fails:

LookupError: unknown encoding: cp1153

Using encoding=cp1047 works, but of course produces garbage with 1153 encoded EBCDIC data...

Should I write own codec? Is there one being used somewhere else?

Thanks for any hints and advice.

Steven Pitman's profile image
Steven Pitman

Hey Milan,

I'm not aware of any package that currently provides the IBM1153 codec - but there is a package available on PyPI and though the IBM Python AI Toolkit called ebcdic, which generates & adds a large number of EBCDIC codecs to Python. You may be able to modify and submit a pull request for IBM1153 to get access to it.

Milan Otajovic's profile image
Milan Otajovic

As a quick solution I built my own cp1153 codec - https://pypi.org/project/ccsid1153-codec/. Perhaps it helps others. Cheers!