blob: 664239bf77011e69f1b92c1875f618d4436c5f66 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
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};")
|