![]() But the code above gives me the character '&' for this in output, which is the EBCDIC character for hex value 0x50.Īlso, tried the below code, with open(path, 'rb') as input_file: For example, the 4th character in the input file is 'P' (after the first three NUL), and if I open the file in hex mode, the hex code for 'P' is 0x50, which maps to character 'P' in ASCII. It does transform the data to some human-readable values for some bytes but doesn't seem to be 100 percent in ASCII. Here is the sample output for the first 58 chars ![]() Line = code(line, 'cp500').encode('utf8')Īlso, tried importing/installing the ebcdic module, but it doesn't seem to be working properly. Line = code('cp500').encode('utf8').strip()Īnd below with io.open(path, 'rb', encoding="cp500") as input_file:Īlso, tried with codecs with codecs.open(path, 'rb') as input_file: I have tried to decode it with 'cp500' and then encode it in 'utf8' in python like below with open(path, 'rb') as input_file: ![]() The sample extract from the sample file looks like the below (in notepad++) I need to convert the EBCDIC files to ASCII using python 2. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
January 2023
Categories |