blob: c43e20be0f11e8d3fdfe358f486b0ac245dd815d [file] [log] [blame]
Marc-André Lemburga866df82001-01-03 21:29:14 +00001""" Python Character Mapping Codec generated from 'CP874.TXT' with gencodec.py.
Guido van Rossum0229bf62000-03-10 23:17:24 +00002
3Written by Marc-Andre Lemburg (mal@lemburg.com).
4
5(c) Copyright CNRI, All Rights Reserved. NO WARRANTY.
Marc-André Lemburga866df82001-01-03 21:29:14 +00006(c) Copyright 2000 Guido van Rossum.
Guido van Rossum0229bf62000-03-10 23:17:24 +00007
8"""#"
9
10import codecs
11
12### Codec APIs
13
14class Codec(codecs.Codec):
15
16 def encode(self,input,errors='strict'):
17
18 return codecs.charmap_encode(input,errors,encoding_map)
19
20 def decode(self,input,errors='strict'):
21
22 return codecs.charmap_decode(input,errors,decoding_map)
23
24class StreamWriter(Codec,codecs.StreamWriter):
25 pass
26
27class StreamReader(Codec,codecs.StreamReader):
28 pass
29
30### encodings module API
31
32def getregentry():
33
34 return (Codec().encode,Codec().decode,StreamReader,StreamWriter)
35
36### Decoding Map
37
Marc-André Lemburga866df82001-01-03 21:29:14 +000038decoding_map = codecs.make_identity_dict(range(256))
39decoding_map.update({
Guido van Rossum0229bf62000-03-10 23:17:24 +000040 0x0080: 0x20ac, # EURO SIGN
41 0x0081: None, # UNDEFINED
42 0x0082: None, # UNDEFINED
43 0x0083: None, # UNDEFINED
44 0x0084: None, # UNDEFINED
45 0x0085: 0x2026, # HORIZONTAL ELLIPSIS
46 0x0086: None, # UNDEFINED
47 0x0087: None, # UNDEFINED
48 0x0088: None, # UNDEFINED
49 0x0089: None, # UNDEFINED
50 0x008a: None, # UNDEFINED
51 0x008b: None, # UNDEFINED
52 0x008c: None, # UNDEFINED
53 0x008d: None, # UNDEFINED
54 0x008e: None, # UNDEFINED
55 0x008f: None, # UNDEFINED
56 0x0090: None, # UNDEFINED
57 0x0091: 0x2018, # LEFT SINGLE QUOTATION MARK
58 0x0092: 0x2019, # RIGHT SINGLE QUOTATION MARK
59 0x0093: 0x201c, # LEFT DOUBLE QUOTATION MARK
60 0x0094: 0x201d, # RIGHT DOUBLE QUOTATION MARK
61 0x0095: 0x2022, # BULLET
62 0x0096: 0x2013, # EN DASH
63 0x0097: 0x2014, # EM DASH
64 0x0098: None, # UNDEFINED
65 0x0099: None, # UNDEFINED
66 0x009a: None, # UNDEFINED
67 0x009b: None, # UNDEFINED
68 0x009c: None, # UNDEFINED
69 0x009d: None, # UNDEFINED
70 0x009e: None, # UNDEFINED
71 0x009f: None, # UNDEFINED
72 0x00a1: 0x0e01, # THAI CHARACTER KO KAI
73 0x00a2: 0x0e02, # THAI CHARACTER KHO KHAI
74 0x00a3: 0x0e03, # THAI CHARACTER KHO KHUAT
75 0x00a4: 0x0e04, # THAI CHARACTER KHO KHWAI
76 0x00a5: 0x0e05, # THAI CHARACTER KHO KHON
77 0x00a6: 0x0e06, # THAI CHARACTER KHO RAKHANG
78 0x00a7: 0x0e07, # THAI CHARACTER NGO NGU
79 0x00a8: 0x0e08, # THAI CHARACTER CHO CHAN
80 0x00a9: 0x0e09, # THAI CHARACTER CHO CHING
81 0x00aa: 0x0e0a, # THAI CHARACTER CHO CHANG
82 0x00ab: 0x0e0b, # THAI CHARACTER SO SO
83 0x00ac: 0x0e0c, # THAI CHARACTER CHO CHOE
84 0x00ad: 0x0e0d, # THAI CHARACTER YO YING
85 0x00ae: 0x0e0e, # THAI CHARACTER DO CHADA
86 0x00af: 0x0e0f, # THAI CHARACTER TO PATAK
87 0x00b0: 0x0e10, # THAI CHARACTER THO THAN
88 0x00b1: 0x0e11, # THAI CHARACTER THO NANGMONTHO
89 0x00b2: 0x0e12, # THAI CHARACTER THO PHUTHAO
90 0x00b3: 0x0e13, # THAI CHARACTER NO NEN
91 0x00b4: 0x0e14, # THAI CHARACTER DO DEK
92 0x00b5: 0x0e15, # THAI CHARACTER TO TAO
93 0x00b6: 0x0e16, # THAI CHARACTER THO THUNG
94 0x00b7: 0x0e17, # THAI CHARACTER THO THAHAN
95 0x00b8: 0x0e18, # THAI CHARACTER THO THONG
96 0x00b9: 0x0e19, # THAI CHARACTER NO NU
97 0x00ba: 0x0e1a, # THAI CHARACTER BO BAIMAI
98 0x00bb: 0x0e1b, # THAI CHARACTER PO PLA
99 0x00bc: 0x0e1c, # THAI CHARACTER PHO PHUNG
100 0x00bd: 0x0e1d, # THAI CHARACTER FO FA
101 0x00be: 0x0e1e, # THAI CHARACTER PHO PHAN
102 0x00bf: 0x0e1f, # THAI CHARACTER FO FAN
103 0x00c0: 0x0e20, # THAI CHARACTER PHO SAMPHAO
104 0x00c1: 0x0e21, # THAI CHARACTER MO MA
105 0x00c2: 0x0e22, # THAI CHARACTER YO YAK
106 0x00c3: 0x0e23, # THAI CHARACTER RO RUA
107 0x00c4: 0x0e24, # THAI CHARACTER RU
108 0x00c5: 0x0e25, # THAI CHARACTER LO LING
109 0x00c6: 0x0e26, # THAI CHARACTER LU
110 0x00c7: 0x0e27, # THAI CHARACTER WO WAEN
111 0x00c8: 0x0e28, # THAI CHARACTER SO SALA
112 0x00c9: 0x0e29, # THAI CHARACTER SO RUSI
113 0x00ca: 0x0e2a, # THAI CHARACTER SO SUA
114 0x00cb: 0x0e2b, # THAI CHARACTER HO HIP
115 0x00cc: 0x0e2c, # THAI CHARACTER LO CHULA
116 0x00cd: 0x0e2d, # THAI CHARACTER O ANG
117 0x00ce: 0x0e2e, # THAI CHARACTER HO NOKHUK
118 0x00cf: 0x0e2f, # THAI CHARACTER PAIYANNOI
119 0x00d0: 0x0e30, # THAI CHARACTER SARA A
120 0x00d1: 0x0e31, # THAI CHARACTER MAI HAN-AKAT
121 0x00d2: 0x0e32, # THAI CHARACTER SARA AA
122 0x00d3: 0x0e33, # THAI CHARACTER SARA AM
123 0x00d4: 0x0e34, # THAI CHARACTER SARA I
124 0x00d5: 0x0e35, # THAI CHARACTER SARA II
125 0x00d6: 0x0e36, # THAI CHARACTER SARA UE
126 0x00d7: 0x0e37, # THAI CHARACTER SARA UEE
127 0x00d8: 0x0e38, # THAI CHARACTER SARA U
128 0x00d9: 0x0e39, # THAI CHARACTER SARA UU
129 0x00da: 0x0e3a, # THAI CHARACTER PHINTHU
130 0x00db: None, # UNDEFINED
131 0x00dc: None, # UNDEFINED
132 0x00dd: None, # UNDEFINED
133 0x00de: None, # UNDEFINED
134 0x00df: 0x0e3f, # THAI CURRENCY SYMBOL BAHT
135 0x00e0: 0x0e40, # THAI CHARACTER SARA E
136 0x00e1: 0x0e41, # THAI CHARACTER SARA AE
137 0x00e2: 0x0e42, # THAI CHARACTER SARA O
138 0x00e3: 0x0e43, # THAI CHARACTER SARA AI MAIMUAN
139 0x00e4: 0x0e44, # THAI CHARACTER SARA AI MAIMALAI
140 0x00e5: 0x0e45, # THAI CHARACTER LAKKHANGYAO
141 0x00e6: 0x0e46, # THAI CHARACTER MAIYAMOK
142 0x00e7: 0x0e47, # THAI CHARACTER MAITAIKHU
143 0x00e8: 0x0e48, # THAI CHARACTER MAI EK
144 0x00e9: 0x0e49, # THAI CHARACTER MAI THO
145 0x00ea: 0x0e4a, # THAI CHARACTER MAI TRI
146 0x00eb: 0x0e4b, # THAI CHARACTER MAI CHATTAWA
147 0x00ec: 0x0e4c, # THAI CHARACTER THANTHAKHAT
148 0x00ed: 0x0e4d, # THAI CHARACTER NIKHAHIT
149 0x00ee: 0x0e4e, # THAI CHARACTER YAMAKKAN
150 0x00ef: 0x0e4f, # THAI CHARACTER FONGMAN
151 0x00f0: 0x0e50, # THAI DIGIT ZERO
152 0x00f1: 0x0e51, # THAI DIGIT ONE
153 0x00f2: 0x0e52, # THAI DIGIT TWO
154 0x00f3: 0x0e53, # THAI DIGIT THREE
155 0x00f4: 0x0e54, # THAI DIGIT FOUR
156 0x00f5: 0x0e55, # THAI DIGIT FIVE
157 0x00f6: 0x0e56, # THAI DIGIT SIX
158 0x00f7: 0x0e57, # THAI DIGIT SEVEN
159 0x00f8: 0x0e58, # THAI DIGIT EIGHT
160 0x00f9: 0x0e59, # THAI DIGIT NINE
161 0x00fa: 0x0e5a, # THAI CHARACTER ANGKHANKHU
162 0x00fb: 0x0e5b, # THAI CHARACTER KHOMUT
163 0x00fc: None, # UNDEFINED
164 0x00fd: None, # UNDEFINED
165 0x00fe: None, # UNDEFINED
166 0x00ff: None, # UNDEFINED
Marc-André Lemburga866df82001-01-03 21:29:14 +0000167})
Guido van Rossum0229bf62000-03-10 23:17:24 +0000168
169### Encoding Map
170
Marc-André Lemburg716cf912001-05-16 09:41:45 +0000171encoding_map = codecs.make_encoding_map(decoding_map)