4 LOWERBASE = map(ord, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz')
6 fo = open('ks.table', 'w')
8 for c1 in range(0xa1, 0xfe+1):
9 for c2 in range(0xa1, 0xfe+1):
11 v = (chr(c1)+chr(c2)).decode('euc-kr')
12 data.append(struct.pack('<H', ord(v)))
14 data.append('\x00\x00')
15 for c1 in range(0x81, 0xa0+1):
16 for c2 in LOWERBASE + range(0x81, 0xfe+1):
18 v = (chr(c1)+chr(c2)).decode('cp949')
19 data.append(struct.pack('<H', ord(v)))
21 data.append('\x00\x00')
22 for c1 in range(0xa1, 0xc6+1):
23 for c2 in LOWERBASE + range(0x81, 0xa0+1):
25 v = (chr(c1)+chr(c2)).decode('cp949')
26 data.append(struct.pack('<H', ord(v)))
28 data.append('\x00\x00')
29 fo.write(struct.pack('<LL', 1, len(data)*2))
30 fo.write(''.join(data))
33 for c in range(0, 0x10000):
35 v = unichr(c).encode('cp949')
41 data.append('\x00\x00')
42 fo.write(struct.pack('<LL', 2, len(data)*2))
43 fo.write(''.join(data))