Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sqlmapproject
GitHub Repository: sqlmapproject/sqlmap
Path: blob/master/thirdparty/chardet/escsm.py
2992 views
1
######################## BEGIN LICENSE BLOCK ########################
2
# The Original Code is mozilla.org code.
3
#
4
# The Initial Developer of the Original Code is
5
# Netscape Communications Corporation.
6
# Portions created by the Initial Developer are Copyright (C) 1998
7
# the Initial Developer. All Rights Reserved.
8
#
9
# Contributor(s):
10
# Mark Pilgrim - port to Python
11
#
12
# This library is free software; you can redistribute it and/or
13
# modify it under the terms of the GNU Lesser General Public
14
# License as published by the Free Software Foundation; either
15
# version 2.1 of the License, or (at your option) any later version.
16
#
17
# This library is distributed in the hope that it will be useful,
18
# but WITHOUT ANY WARRANTY; without even the implied warranty of
19
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20
# Lesser General Public License for more details.
21
#
22
# You should have received a copy of the GNU Lesser General Public
23
# License along with this library; if not, write to the Free Software
24
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
25
# 02110-1301 USA
26
######################### END LICENSE BLOCK #########################
27
28
from .enums import MachineState
29
30
HZ_CLS = (
31
1,0,0,0,0,0,0,0, # 00 - 07
32
0,0,0,0,0,0,0,0, # 08 - 0f
33
0,0,0,0,0,0,0,0, # 10 - 17
34
0,0,0,1,0,0,0,0, # 18 - 1f
35
0,0,0,0,0,0,0,0, # 20 - 27
36
0,0,0,0,0,0,0,0, # 28 - 2f
37
0,0,0,0,0,0,0,0, # 30 - 37
38
0,0,0,0,0,0,0,0, # 38 - 3f
39
0,0,0,0,0,0,0,0, # 40 - 47
40
0,0,0,0,0,0,0,0, # 48 - 4f
41
0,0,0,0,0,0,0,0, # 50 - 57
42
0,0,0,0,0,0,0,0, # 58 - 5f
43
0,0,0,0,0,0,0,0, # 60 - 67
44
0,0,0,0,0,0,0,0, # 68 - 6f
45
0,0,0,0,0,0,0,0, # 70 - 77
46
0,0,0,4,0,5,2,0, # 78 - 7f
47
1,1,1,1,1,1,1,1, # 80 - 87
48
1,1,1,1,1,1,1,1, # 88 - 8f
49
1,1,1,1,1,1,1,1, # 90 - 97
50
1,1,1,1,1,1,1,1, # 98 - 9f
51
1,1,1,1,1,1,1,1, # a0 - a7
52
1,1,1,1,1,1,1,1, # a8 - af
53
1,1,1,1,1,1,1,1, # b0 - b7
54
1,1,1,1,1,1,1,1, # b8 - bf
55
1,1,1,1,1,1,1,1, # c0 - c7
56
1,1,1,1,1,1,1,1, # c8 - cf
57
1,1,1,1,1,1,1,1, # d0 - d7
58
1,1,1,1,1,1,1,1, # d8 - df
59
1,1,1,1,1,1,1,1, # e0 - e7
60
1,1,1,1,1,1,1,1, # e8 - ef
61
1,1,1,1,1,1,1,1, # f0 - f7
62
1,1,1,1,1,1,1,1, # f8 - ff
63
)
64
65
HZ_ST = (
66
MachineState.START,MachineState.ERROR, 3,MachineState.START,MachineState.START,MachineState.START,MachineState.ERROR,MachineState.ERROR,# 00-07
67
MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,# 08-0f
68
MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ERROR,MachineState.ERROR,MachineState.START,MachineState.START, 4,MachineState.ERROR,# 10-17
69
5,MachineState.ERROR, 6,MachineState.ERROR, 5, 5, 4,MachineState.ERROR,# 18-1f
70
4,MachineState.ERROR, 4, 4, 4,MachineState.ERROR, 4,MachineState.ERROR,# 20-27
71
4,MachineState.ITS_ME,MachineState.START,MachineState.START,MachineState.START,MachineState.START,MachineState.START,MachineState.START,# 28-2f
72
)
73
74
HZ_CHAR_LEN_TABLE = (0, 0, 0, 0, 0, 0)
75
76
HZ_SM_MODEL = {'class_table': HZ_CLS,
77
'class_factor': 6,
78
'state_table': HZ_ST,
79
'char_len_table': HZ_CHAR_LEN_TABLE,
80
'name': "HZ-GB-2312",
81
'language': 'Chinese'}
82
83
ISO2022CN_CLS = (
84
2,0,0,0,0,0,0,0, # 00 - 07
85
0,0,0,0,0,0,0,0, # 08 - 0f
86
0,0,0,0,0,0,0,0, # 10 - 17
87
0,0,0,1,0,0,0,0, # 18 - 1f
88
0,0,0,0,0,0,0,0, # 20 - 27
89
0,3,0,0,0,0,0,0, # 28 - 2f
90
0,0,0,0,0,0,0,0, # 30 - 37
91
0,0,0,0,0,0,0,0, # 38 - 3f
92
0,0,0,4,0,0,0,0, # 40 - 47
93
0,0,0,0,0,0,0,0, # 48 - 4f
94
0,0,0,0,0,0,0,0, # 50 - 57
95
0,0,0,0,0,0,0,0, # 58 - 5f
96
0,0,0,0,0,0,0,0, # 60 - 67
97
0,0,0,0,0,0,0,0, # 68 - 6f
98
0,0,0,0,0,0,0,0, # 70 - 77
99
0,0,0,0,0,0,0,0, # 78 - 7f
100
2,2,2,2,2,2,2,2, # 80 - 87
101
2,2,2,2,2,2,2,2, # 88 - 8f
102
2,2,2,2,2,2,2,2, # 90 - 97
103
2,2,2,2,2,2,2,2, # 98 - 9f
104
2,2,2,2,2,2,2,2, # a0 - a7
105
2,2,2,2,2,2,2,2, # a8 - af
106
2,2,2,2,2,2,2,2, # b0 - b7
107
2,2,2,2,2,2,2,2, # b8 - bf
108
2,2,2,2,2,2,2,2, # c0 - c7
109
2,2,2,2,2,2,2,2, # c8 - cf
110
2,2,2,2,2,2,2,2, # d0 - d7
111
2,2,2,2,2,2,2,2, # d8 - df
112
2,2,2,2,2,2,2,2, # e0 - e7
113
2,2,2,2,2,2,2,2, # e8 - ef
114
2,2,2,2,2,2,2,2, # f0 - f7
115
2,2,2,2,2,2,2,2, # f8 - ff
116
)
117
118
ISO2022CN_ST = (
119
MachineState.START, 3,MachineState.ERROR,MachineState.START,MachineState.START,MachineState.START,MachineState.START,MachineState.START,# 00-07
120
MachineState.START,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,# 08-0f
121
MachineState.ERROR,MachineState.ERROR,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,# 10-17
122
MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR, 4,MachineState.ERROR,# 18-1f
123
MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ITS_ME,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,# 20-27
124
5, 6,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,# 28-2f
125
MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ITS_ME,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,# 30-37
126
MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ITS_ME,MachineState.ERROR,MachineState.START,# 38-3f
127
)
128
129
ISO2022CN_CHAR_LEN_TABLE = (0, 0, 0, 0, 0, 0, 0, 0, 0)
130
131
ISO2022CN_SM_MODEL = {'class_table': ISO2022CN_CLS,
132
'class_factor': 9,
133
'state_table': ISO2022CN_ST,
134
'char_len_table': ISO2022CN_CHAR_LEN_TABLE,
135
'name': "ISO-2022-CN",
136
'language': 'Chinese'}
137
138
ISO2022JP_CLS = (
139
2,0,0,0,0,0,0,0, # 00 - 07
140
0,0,0,0,0,0,2,2, # 08 - 0f
141
0,0,0,0,0,0,0,0, # 10 - 17
142
0,0,0,1,0,0,0,0, # 18 - 1f
143
0,0,0,0,7,0,0,0, # 20 - 27
144
3,0,0,0,0,0,0,0, # 28 - 2f
145
0,0,0,0,0,0,0,0, # 30 - 37
146
0,0,0,0,0,0,0,0, # 38 - 3f
147
6,0,4,0,8,0,0,0, # 40 - 47
148
0,9,5,0,0,0,0,0, # 48 - 4f
149
0,0,0,0,0,0,0,0, # 50 - 57
150
0,0,0,0,0,0,0,0, # 58 - 5f
151
0,0,0,0,0,0,0,0, # 60 - 67
152
0,0,0,0,0,0,0,0, # 68 - 6f
153
0,0,0,0,0,0,0,0, # 70 - 77
154
0,0,0,0,0,0,0,0, # 78 - 7f
155
2,2,2,2,2,2,2,2, # 80 - 87
156
2,2,2,2,2,2,2,2, # 88 - 8f
157
2,2,2,2,2,2,2,2, # 90 - 97
158
2,2,2,2,2,2,2,2, # 98 - 9f
159
2,2,2,2,2,2,2,2, # a0 - a7
160
2,2,2,2,2,2,2,2, # a8 - af
161
2,2,2,2,2,2,2,2, # b0 - b7
162
2,2,2,2,2,2,2,2, # b8 - bf
163
2,2,2,2,2,2,2,2, # c0 - c7
164
2,2,2,2,2,2,2,2, # c8 - cf
165
2,2,2,2,2,2,2,2, # d0 - d7
166
2,2,2,2,2,2,2,2, # d8 - df
167
2,2,2,2,2,2,2,2, # e0 - e7
168
2,2,2,2,2,2,2,2, # e8 - ef
169
2,2,2,2,2,2,2,2, # f0 - f7
170
2,2,2,2,2,2,2,2, # f8 - ff
171
)
172
173
ISO2022JP_ST = (
174
MachineState.START, 3,MachineState.ERROR,MachineState.START,MachineState.START,MachineState.START,MachineState.START,MachineState.START,# 00-07
175
MachineState.START,MachineState.START,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,# 08-0f
176
MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,# 10-17
177
MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ERROR,MachineState.ERROR,# 18-1f
178
MachineState.ERROR, 5,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR, 4,MachineState.ERROR,MachineState.ERROR,# 20-27
179
MachineState.ERROR,MachineState.ERROR,MachineState.ERROR, 6,MachineState.ITS_ME,MachineState.ERROR,MachineState.ITS_ME,MachineState.ERROR,# 28-2f
180
MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ITS_ME,MachineState.ITS_ME,# 30-37
181
MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ITS_ME,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,# 38-3f
182
MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ITS_ME,MachineState.ERROR,MachineState.START,MachineState.START,# 40-47
183
)
184
185
ISO2022JP_CHAR_LEN_TABLE = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
186
187
ISO2022JP_SM_MODEL = {'class_table': ISO2022JP_CLS,
188
'class_factor': 10,
189
'state_table': ISO2022JP_ST,
190
'char_len_table': ISO2022JP_CHAR_LEN_TABLE,
191
'name': "ISO-2022-JP",
192
'language': 'Japanese'}
193
194
ISO2022KR_CLS = (
195
2,0,0,0,0,0,0,0, # 00 - 07
196
0,0,0,0,0,0,0,0, # 08 - 0f
197
0,0,0,0,0,0,0,0, # 10 - 17
198
0,0,0,1,0,0,0,0, # 18 - 1f
199
0,0,0,0,3,0,0,0, # 20 - 27
200
0,4,0,0,0,0,0,0, # 28 - 2f
201
0,0,0,0,0,0,0,0, # 30 - 37
202
0,0,0,0,0,0,0,0, # 38 - 3f
203
0,0,0,5,0,0,0,0, # 40 - 47
204
0,0,0,0,0,0,0,0, # 48 - 4f
205
0,0,0,0,0,0,0,0, # 50 - 57
206
0,0,0,0,0,0,0,0, # 58 - 5f
207
0,0,0,0,0,0,0,0, # 60 - 67
208
0,0,0,0,0,0,0,0, # 68 - 6f
209
0,0,0,0,0,0,0,0, # 70 - 77
210
0,0,0,0,0,0,0,0, # 78 - 7f
211
2,2,2,2,2,2,2,2, # 80 - 87
212
2,2,2,2,2,2,2,2, # 88 - 8f
213
2,2,2,2,2,2,2,2, # 90 - 97
214
2,2,2,2,2,2,2,2, # 98 - 9f
215
2,2,2,2,2,2,2,2, # a0 - a7
216
2,2,2,2,2,2,2,2, # a8 - af
217
2,2,2,2,2,2,2,2, # b0 - b7
218
2,2,2,2,2,2,2,2, # b8 - bf
219
2,2,2,2,2,2,2,2, # c0 - c7
220
2,2,2,2,2,2,2,2, # c8 - cf
221
2,2,2,2,2,2,2,2, # d0 - d7
222
2,2,2,2,2,2,2,2, # d8 - df
223
2,2,2,2,2,2,2,2, # e0 - e7
224
2,2,2,2,2,2,2,2, # e8 - ef
225
2,2,2,2,2,2,2,2, # f0 - f7
226
2,2,2,2,2,2,2,2, # f8 - ff
227
)
228
229
ISO2022KR_ST = (
230
MachineState.START, 3,MachineState.ERROR,MachineState.START,MachineState.START,MachineState.START,MachineState.ERROR,MachineState.ERROR,# 00-07
231
MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,# 08-0f
232
MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR, 4,MachineState.ERROR,MachineState.ERROR,# 10-17
233
MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR, 5,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,# 18-1f
234
MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ITS_ME,MachineState.START,MachineState.START,MachineState.START,MachineState.START,# 20-27
235
)
236
237
ISO2022KR_CHAR_LEN_TABLE = (0, 0, 0, 0, 0, 0)
238
239
ISO2022KR_SM_MODEL = {'class_table': ISO2022KR_CLS,
240
'class_factor': 6,
241
'state_table': ISO2022KR_ST,
242
'char_len_table': ISO2022KR_CHAR_LEN_TABLE,
243
'name': "ISO-2022-KR",
244
'language': 'Korean'}
245
246
247
248