If the file is in , convert first:

import codecs with open('cp_7_9_12_v17_0.fwf', 'rb') as f: raw = f.read() text = codecs.decode(raw, 'cp500') # or 'cp1047' for IBM mainframe library(readr) fwf_positions <- fwf_widths(c(7, 9, 12), col_names = c("field1", "field2", "field3"))

It sounds like you’re working with a fixed-width file ( .fwf ) that follows a specific record layout — likely from a legacy system, mainframe, or EDI feed. The filename cp_7_9_12_v17_0.fwf suggests it may be a control parameter or copybook-style layout, possibly with record lengths or field positions derived from a COBOL copybook.