TotalDepth.util.EBCDIC

Support for EBCDIC character encoding.

References:

https://en.wikipedia.org/wiki/EBCDIC

https://www.ibm.com/support/knowledgecenter/SSGH4D_16.1.0/com.ibm.xlf161.aix.doc/language_ref/asciit.html

From: https://www.ibm.com/support/knowledgecenter/ssw_ibm_i_71/rzaat/rzaate.htm

“EBCDIC single-byte encoding scheme An 8-bit-per-byte structure. The EBCDIC single-byte structure has a valid code-point range for 00 to FF Control characters have a range from 00 to 3F. Graphic characters have a range from 41 to FE. The space character is 40.”

TotalDepth.util.EBCDIC.EBCDIC_ALL = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 63, 64, 74, 75, 76, 77, 78, 79, 80, 90, 91, 92, 93, 94, 95, 96, 97, 106, 107, 108, 109, 110, 111, 121, 122, 123, 124, 125, 126, 127, 129, 130, 131, 132, 133, 134, 135, 136, 137, 143, 145, 146, 147, 148, 149, 150, 151, 152, 153, 161, 162, 163, 164, 165, 166, 167, 168, 169, 176, 186, 187, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 255}

EBCDIC all character points. From https://en.wikipedia.org/wiki/EBCDIC

TotalDepth.util.EBCDIC.EBCDIC_PRINTABLE = {5, 11, 12, 13, 37, 64, 74, 75, 76, 77, 78, 79, 80, 90, 91, 92, 93, 94, 95, 96, 97, 107, 108, 109, 110, 111, 121, 122, 123, 124, 125, 126, 127, 129, 130, 131, 132, 133, 134, 135, 136, 137, 145, 146, 147, 148, 149, 150, 151, 152, 153, 161, 162, 163, 164, 165, 166, 167, 168, 169, 187, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 224, 226, 227, 228, 229, 230, 231, 232, 233, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249}

Printable range. This is obtained by using cp500:

string.printable.encode('cp500')

Which gives:

EBCDIC_PRINTABLE = {5, 11, 12, 13, 37, 64, 74, 75, 76, 77, 78, 79, 80, 90, 91, 92, 93, 94, 95, 96, 97, 107, 108, 109,
110, 111, 121, 122, 123, 124, 125, 126, 127, 129, 130, 131, 132, 133, 134, 135, 136, 137, 145, 146,
147, 148, 149, 150, 151, 152, 153, 161, 162, 163, 164, 165, 166, 167, 168, 169, 187, 192, 193, 194,
195, 196, 197, 198, 199, 200, 201, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 224, 226, 227,
228, 229, 230, 231, 232, 233, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249}
class TotalDepth.util.EBCDIC.EbcdicAsciiTableEntry

A single entry in the EBCDIC table.

decimal_str

Alias for field number 0

hex_str

Alias for field number 1

ctrl_char

Alias for field number 2

ascii

Alias for field number 3

ascii_meaning

Alias for field number 4

ebcdic

Alias for field number 5

ebcdic_meaning

Alias for field number 6

value

Returns the decimal value of the entry.

is_ctrl

Returns True if this is a control character, False otherwise.

ctrl_symbol

The single control character or ‘’. For example decimal value 3 returns ‘C’.

ebcdic_printable

Returns True if this is a printable character, False otherwise.

__getnewargs__()

Return self as a plain tuple. Used by copy and pickle.

static __new__(_cls, decimal_str: str, hex_str: str, ctrl_char: str, ascii: str, ascii_meaning: str, ebcdic: str, ebcdic_meaning: str)

Create new instance of EbcdicAsciiTableEntry(decimal_str, hex_str, ctrl_char, ascii, ascii_meaning, ebcdic, ebcdic_meaning)

__repr__()

Return a nicely formatted representation string

TotalDepth.util.EBCDIC.ebcdic_all_printable(byt: bytes) → bool

True if all character codes are printable EBCDIC.

TotalDepth.util.EBCDIC.ebcdic_ascii_description(byt: bytes) → TotalDepth.util.EBCDIC.EbcdicAsciiTableEntry

Look up the first character in the given bytes and return the EBCDIC table entry.

TotalDepth.util.EBCDIC.ebcdic_to_ascii(byt: bytes) → str

Convert EBCDIC to ASCII.

TotalDepth.util.EBCDIC.ascii_to_ebcdic(ascii_str: str) → bytes

Convert ASCII to EBCDIC.