from encodings import iso8859_2 table = [] for ch in iso8859_2.decoding_table: # length = 256 if ch == '\ufffd': # undefined bytes (if any) table.append(0x0000) # or 0xFFFD if you prefer else: table.append(ord(ch)) print("static const uint32_t iso8859_2_to_utf32[256] = {") for i, v in enumerate(table): if i % 8 == 0: print(" ", end="") print(f"0x{v:04X}, ", end="") if i % 8 == 7: print() print("\n};")