Skip to content

Commit fdcca4b

Browse files
committedDec 15, 2017
add Windows 1253/1254/1257 encodings
1 parent 98bf9e8 commit fdcca4b

File tree

4 files changed

+468
-6
lines changed

4 files changed

+468
-6
lines changed
 

‎src/org/jcodings/EncodingList.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ static final void load() {
6161
EncodingDB.declare("Windows-1250", "Windows_1250");
6262
EncodingDB.declare("Windows-1251", "Windows_1251");
6363
EncodingDB.declare("Windows-1252", "Windows_1252");
64+
EncodingDB.declare("Windows-1253", "Windows_1253");
65+
EncodingDB.declare("Windows-1254", "Windows_1254");
66+
EncodingDB.declare("Windows-1257", "Windows_1257");
6467
EncodingDB.ascii = EncodingDB.encodings.get("ASCII-8BIT".getBytes());
6568
EncodingDB.alias("BINARY", "ASCII-8BIT");
6669
EncodingDB.replicate("IBM437", "ASCII-8BIT");
@@ -141,22 +144,16 @@ static final void load() {
141144
EncodingDB.replicate("Windows-1256", "ISO-8859-6");
142145
EncodingDB.alias("CP1256", "Windows-1256");
143146
EncodingDB.alias("ISO8859-7", "ISO-8859-7");
144-
EncodingDB.replicate("Windows-1253", "ISO-8859-7");
145-
EncodingDB.alias("CP1253", "Windows-1253");
146147
EncodingDB.alias("ISO8859-8", "ISO-8859-8");
147148
EncodingDB.replicate("Windows-1255", "ISO-8859-8");
148149
EncodingDB.alias("CP1255", "Windows-1255");
149150
EncodingDB.alias("ISO8859-9", "ISO-8859-9");
150-
EncodingDB.replicate("Windows-1254", "ISO-8859-9");
151-
EncodingDB.alias("CP1254", "Windows-1254");
152151
EncodingDB.alias("ISO8859-10", "ISO-8859-10");
153152
EncodingDB.alias("ISO8859-11", "ISO-8859-11");
154153
EncodingDB.replicate("TIS-620", "ISO-8859-11");
155154
EncodingDB.replicate("Windows-874", "ISO-8859-11");
156155
EncodingDB.alias("CP874", "Windows-874");
157156
EncodingDB.alias("ISO8859-13", "ISO-8859-13");
158-
EncodingDB.replicate("Windows-1257", "ISO-8859-13");
159-
EncodingDB.alias("CP1257", "Windows-1257");
160157
EncodingDB.alias("ISO8859-14", "ISO-8859-14");
161158
EncodingDB.alias("ISO8859-15", "ISO-8859-15");
162159
EncodingDB.alias("ISO8859-16", "ISO-8859-16");
@@ -184,6 +181,9 @@ static final void load() {
184181
EncodingDB.alias("CP1250", "Windows-1250");
185182
EncodingDB.alias("CP1251", "Windows-1251");
186183
EncodingDB.alias("CP1252", "Windows-1252");
184+
EncodingDB.alias("CP1253", "Windows-1253");
185+
EncodingDB.alias("CP1254", "Windows-1254");
186+
EncodingDB.alias("CP1257", "Windows-1257");
187187
EncodingDB.replicate("UTF8-DoCoMo", "UTF-8");
188188
EncodingDB.replicate("SJIS-DoCoMo", "Windows-31J");
189189
EncodingDB.replicate("UTF8-KDDI", "UTF-8");
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
/*
2+
* Permission is hereby granted, free of charge, to any person obtaining a copy of
3+
* this software and associated documentation files (the "Software"), to deal in
4+
* the Software without restriction, including without limitation the rights to
5+
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
6+
* of the Software, and to permit persons to whom the Software is furnished to do
7+
* so, subject to the following conditions:
8+
*
9+
* The above copyright notice and this permission notice shall be included in all
10+
* copies or substantial portions of the Software.
11+
*
12+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
15+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
16+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
17+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
18+
* SOFTWARE.
19+
*/
20+
package org.jcodings.specific;
21+
22+
import org.jcodings.CaseFoldMapEncoding;
23+
import org.jcodings.IntHolder;
24+
25+
final public class Windows_1253Encoding extends CaseFoldMapEncoding {
26+
27+
protected Windows_1253Encoding() {
28+
super("Windows-1253", CP1253_CtypeTable, CP1253_ToLowerCaseTable, CP1253_CaseFoldMap, true);
29+
}
30+
31+
@Override
32+
public int mbcCaseFold(int flag, byte[]bytes, IntHolder pp, int end, byte[]lower) {
33+
int p = pp.value;
34+
int lowerP = 0;
35+
36+
lower[lowerP] = LowerCaseTable[bytes[p] & 0xff];
37+
pp.value++;
38+
return 1;
39+
}
40+
41+
@Override
42+
public boolean isCodeCType(int code, int ctype) {
43+
return code < 256 ? isCodeCTypeInternal(code, ctype) : false;
44+
}
45+
46+
static final short CP1253_CtypeTable[] = {
47+
0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008,
48+
0x4008, 0x420c, 0x4209, 0x4208, 0x4208, 0x4208, 0x4008, 0x4008,
49+
0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008,
50+
0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008,
51+
0x4284, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0,
52+
0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0,
53+
0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0,
54+
0x78b0, 0x78b0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0,
55+
0x41a0, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x74a2,
56+
0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2,
57+
0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2,
58+
0x74a2, 0x74a2, 0x74a2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x51a0,
59+
0x41a0, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x70e2,
60+
0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2,
61+
0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2,
62+
0x70e2, 0x70e2, 0x70e2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x4008,
63+
0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008,
64+
0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008,
65+
0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008,
66+
0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008,
67+
0x0284, 0x01a0, 0x34a2, 0x00a0, 0x0000, 0x0000, 0x00a0, 0x00a0,
68+
0x00a0, 0x00a0, 0x0000, 0x01a0, 0x00a0, 0x01a0, 0x0000, 0x01a0,
69+
0x00a0, 0x00a0, 0x10a0, 0x10a0, 0x00a0, 0x30e2, 0x34a2, 0x01a0,
70+
0x34a2, 0x34a2, 0x34a2, 0x01a0, 0x34a2, 0x10a0, 0x34a2, 0x34a2,
71+
0x30e2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2,
72+
0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2,
73+
0x34a2, 0x34a2, 0x0000, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2,
74+
0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x30e2, 0x30e2, 0x30e2, 0x30e2,
75+
0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2,
76+
0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2,
77+
0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2,
78+
0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x0000
79+
};
80+
81+
static final byte CP1253_ToLowerCaseTable[] = new byte[]{
82+
(byte)'\000', (byte)'\001', (byte)'\002', (byte)'\003', (byte)'\004', (byte)'\005', (byte)'\006', (byte)'\007',
83+
(byte)'\010', (byte)'\011', (byte)'\012', (byte)'\013', (byte)'\014', (byte)'\015', (byte)'\016', (byte)'\017',
84+
(byte)'\020', (byte)'\021', (byte)'\022', (byte)'\023', (byte)'\024', (byte)'\025', (byte)'\026', (byte)'\027',
85+
(byte)'\030', (byte)'\031', (byte)'\032', (byte)'\033', (byte)'\034', (byte)'\035', (byte)'\036', (byte)'\037',
86+
(byte)'\040', (byte)'\041', (byte)'\042', (byte)'\043', (byte)'\044', (byte)'\045', (byte)'\046', (byte)'\047',
87+
(byte)'\050', (byte)'\051', (byte)'\052', (byte)'\053', (byte)'\054', (byte)'\055', (byte)'\056', (byte)'\057',
88+
(byte)'\060', (byte)'\061', (byte)'\062', (byte)'\063', (byte)'\064', (byte)'\065', (byte)'\066', (byte)'\067',
89+
(byte)'\070', (byte)'\071', (byte)'\072', (byte)'\073', (byte)'\074', (byte)'\075', (byte)'\076', (byte)'\077',
90+
(byte)'\100', (byte)'\141', (byte)'\142', (byte)'\143', (byte)'\144', (byte)'\145', (byte)'\146', (byte)'\147',
91+
(byte)'\150', (byte)'\151', (byte)'\152', (byte)'\153', (byte)'\154', (byte)'\155', (byte)'\156', (byte)'\157',
92+
(byte)'\160', (byte)'\161', (byte)'\162', (byte)'\163', (byte)'\164', (byte)'\165', (byte)'\166', (byte)'\167',
93+
(byte)'\170', (byte)'\171', (byte)'\172', (byte)'\133', (byte)'\134', (byte)'\135', (byte)'\136', (byte)'\137',
94+
(byte)'\140', (byte)'\141', (byte)'\142', (byte)'\143', (byte)'\144', (byte)'\145', (byte)'\146', (byte)'\147',
95+
(byte)'\150', (byte)'\151', (byte)'\152', (byte)'\153', (byte)'\154', (byte)'\155', (byte)'\156', (byte)'\157',
96+
(byte)'\160', (byte)'\161', (byte)'\162', (byte)'\163', (byte)'\164', (byte)'\165', (byte)'\166', (byte)'\167',
97+
(byte)'\170', (byte)'\171', (byte)'\172', (byte)'\173', (byte)'\174', (byte)'\175', (byte)'\176', (byte)'\177',
98+
(byte)'\200', (byte)'\201', (byte)'\202', (byte)'\203', (byte)'\204', (byte)'\205', (byte)'\206', (byte)'\207',
99+
(byte)'\210', (byte)'\211', (byte)'\212', (byte)'\213', (byte)'\214', (byte)'\215', (byte)'\216', (byte)'\217',
100+
(byte)'\220', (byte)'\221', (byte)'\222', (byte)'\223', (byte)'\224', (byte)'\225', (byte)'\226', (byte)'\227',
101+
(byte)'\230', (byte)'\231', (byte)'\232', (byte)'\233', (byte)'\234', (byte)'\235', (byte)'\236', (byte)'\237',
102+
(byte)'\240', (byte)'\241', (byte)'\334', (byte)'\243', (byte)'\244', (byte)'\245', (byte)'\246', (byte)'\247',
103+
(byte)'\250', (byte)'\251', (byte)'\252', (byte)'\253', (byte)'\254', (byte)'\255', (byte)'\256', (byte)'\257',
104+
(byte)'\260', (byte)'\261', (byte)'\262', (byte)'\263', (byte)'\264', (byte)'\354', (byte)'\334', (byte)'\267',
105+
(byte)'\335', (byte)'\336', (byte)'\337', (byte)'\273', (byte)'\374', (byte)'\275', (byte)'\375', (byte)'\376',
106+
(byte)'\300', (byte)'\341', (byte)'\342', (byte)'\343', (byte)'\344', (byte)'\345', (byte)'\346', (byte)'\347',
107+
(byte)'\350', (byte)'\351', (byte)'\352', (byte)'\353', (byte)'\354', (byte)'\355', (byte)'\356', (byte)'\357',
108+
(byte)'\360', (byte)'\361', (byte)'\322', (byte)'\363', (byte)'\364', (byte)'\365', (byte)'\366', (byte)'\367',
109+
(byte)'\370', (byte)'\371', (byte)'\372', (byte)'\373', (byte)'\334', (byte)'\335', (byte)'\336', (byte)'\337',
110+
(byte)'\340', (byte)'\341', (byte)'\342', (byte)'\343', (byte)'\344', (byte)'\345', (byte)'\346', (byte)'\347',
111+
(byte)'\350', (byte)'\351', (byte)'\352', (byte)'\353', (byte)'\354', (byte)'\355', (byte)'\356', (byte)'\357',
112+
(byte)'\360', (byte)'\361', (byte)'\362', (byte)'\363', (byte)'\364', (byte)'\365', (byte)'\366', (byte)'\367',
113+
(byte)'\370', (byte)'\371', (byte)'\372', (byte)'\373', (byte)'\374', (byte)'\375', (byte)'\376', (byte)'\377'
114+
};
115+
116+
static final int CP1253_CaseFoldMap[][] = {
117+
{ 0xb6, 0xdc },
118+
{ 0xb8, 0xdd },
119+
{ 0xb9, 0xde },
120+
{ 0xba, 0xdf },
121+
{ 0xbc, 0xfc },
122+
{ 0xbe, 0xfd },
123+
{ 0xbf, 0xfe },
124+
125+
{ 0xc1, 0xe1 },
126+
{ 0xc2, 0xe2 },
127+
{ 0xc3, 0xe3 },
128+
{ 0xc4, 0xe4 },
129+
{ 0xc5, 0xe5 },
130+
{ 0xc6, 0xe6 },
131+
{ 0xc7, 0xe7 },
132+
{ 0xc8, 0xe8 },
133+
{ 0xc9, 0xe9 },
134+
{ 0xca, 0xea },
135+
{ 0xcb, 0xeb },
136+
{ 0xcc, 0xec },
137+
{ 0xcd, 0xed },
138+
{ 0xce, 0xee },
139+
{ 0xcf, 0xef },
140+
141+
{ 0xd0, 0xf0 },
142+
{ 0xd1, 0xf1 },
143+
{ 0xd2, 0xf2 },
144+
{ 0xd3, 0xf3 },
145+
{ 0xd4, 0xf4 },
146+
{ 0xd5, 0xf5 },
147+
{ 0xd6, 0xf6 },
148+
{ 0xd7, 0xf7 },
149+
{ 0xd8, 0xf8 },
150+
{ 0xd9, 0xf9 },
151+
{ 0xda, 0xfa },
152+
{ 0xdb, 0xfb }
153+
};
154+
155+
public static final Windows_1253Encoding INSTANCE = new Windows_1253Encoding();
156+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
/*
2+
* Permission is hereby granted, free of charge, to any person obtaining a copy of
3+
* this software and associated documentation files (the "Software"), to deal in
4+
* the Software without restriction, including without limitation the rights to
5+
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
6+
* of the Software, and to permit persons to whom the Software is furnished to do
7+
* so, subject to the following conditions:
8+
*
9+
* The above copyright notice and this permission notice shall be included in all
10+
* copies or substantial portions of the Software.
11+
*
12+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
15+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
16+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
17+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
18+
* SOFTWARE.
19+
*/
20+
package org.jcodings.specific;
21+
22+
import org.jcodings.CaseFoldMapEncoding;
23+
import org.jcodings.IntHolder;
24+
25+
final public class Windows_1254Encoding extends CaseFoldMapEncoding {
26+
27+
protected Windows_1254Encoding() {
28+
super("Windows-1254", CP1254_CtypeTable, CP1254_ToLowerCaseTable, CP1254_CaseFoldMap, true);
29+
}
30+
31+
@Override
32+
public int mbcCaseFold(int flag, byte[]bytes, IntHolder pp, int end, byte[]lower) {
33+
int p = pp.value;
34+
int lowerP = 0;
35+
36+
lower[lowerP] = LowerCaseTable[bytes[p] & 0xff];
37+
pp.value++;
38+
return 1;
39+
}
40+
41+
@Override
42+
public boolean isCodeCType(int code, int ctype) {
43+
return code < 256 ? isCodeCTypeInternal(code, ctype) : false;
44+
}
45+
46+
static final short CP1254_CtypeTable[] = {
47+
0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008,
48+
0x4008, 0x420c, 0x4209, 0x4208, 0x4208, 0x4208, 0x4008, 0x4008,
49+
0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008,
50+
0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008,
51+
0x4284, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0,
52+
0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0,
53+
0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0,
54+
0x78b0, 0x78b0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0,
55+
0x41a0, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x74a2,
56+
0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2,
57+
0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2,
58+
0x74a2, 0x74a2, 0x74a2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x51a0,
59+
0x41a0, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x70e2,
60+
0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2,
61+
0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2,
62+
0x70e2, 0x70e2, 0x70e2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x4008,
63+
0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008,
64+
0x0008, 0x0008, 0x34a2, 0x0008, 0x34a2, 0x0008, 0x0008, 0x0008,
65+
0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008,
66+
0x0008, 0x0008, 0x30e2, 0x0008, 0x30e2, 0x0008, 0x0008, 0x34a2,
67+
0x0284, 0x01a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0,
68+
0x00a0, 0x00a0, 0x30e2, 0x01a0, 0x00a0, 0x01a0, 0x00a0, 0x00a0,
69+
0x00a0, 0x00a0, 0x10a0, 0x10a0, 0x00a0, 0x30e2, 0x00a0, 0x01a0,
70+
0x00a0, 0x10a0, 0x30e2, 0x01a0, 0x10a0, 0x10a0, 0x10a0, 0x01a0,
71+
0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2,
72+
0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2,
73+
0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x00a0,
74+
0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x30e2,
75+
0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2,
76+
0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2,
77+
0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x00a0,
78+
0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2
79+
};
80+
81+
static final byte CP1254_ToLowerCaseTable[] = new byte[]{
82+
(byte)'\000', (byte)'\001', (byte)'\002', (byte)'\003', (byte)'\004', (byte)'\005', (byte)'\006', (byte)'\007',
83+
(byte)'\010', (byte)'\011', (byte)'\012', (byte)'\013', (byte)'\014', (byte)'\015', (byte)'\016', (byte)'\017',
84+
(byte)'\020', (byte)'\021', (byte)'\022', (byte)'\023', (byte)'\024', (byte)'\025', (byte)'\026', (byte)'\027',
85+
(byte)'\030', (byte)'\031', (byte)'\032', (byte)'\033', (byte)'\034', (byte)'\035', (byte)'\036', (byte)'\037',
86+
(byte)'\040', (byte)'\041', (byte)'\042', (byte)'\043', (byte)'\044', (byte)'\045', (byte)'\046', (byte)'\047',
87+
(byte)'\050', (byte)'\051', (byte)'\052', (byte)'\053', (byte)'\054', (byte)'\055', (byte)'\056', (byte)'\057',
88+
(byte)'\060', (byte)'\061', (byte)'\062', (byte)'\063', (byte)'\064', (byte)'\065', (byte)'\066', (byte)'\067',
89+
(byte)'\070', (byte)'\071', (byte)'\072', (byte)'\073', (byte)'\074', (byte)'\075', (byte)'\076', (byte)'\077',
90+
(byte)'\100', (byte)'\141', (byte)'\142', (byte)'\143', (byte)'\144', (byte)'\145', (byte)'\146', (byte)'\147',
91+
(byte)'\150', (byte)'\151', (byte)'\152', (byte)'\153', (byte)'\154', (byte)'\155', (byte)'\156', (byte)'\157',
92+
(byte)'\160', (byte)'\161', (byte)'\162', (byte)'\163', (byte)'\164', (byte)'\165', (byte)'\166', (byte)'\167',
93+
(byte)'\170', (byte)'\171', (byte)'\172', (byte)'\133', (byte)'\134', (byte)'\135', (byte)'\136', (byte)'\137',
94+
(byte)'\140', (byte)'\141', (byte)'\142', (byte)'\143', (byte)'\144', (byte)'\145', (byte)'\146', (byte)'\147',
95+
(byte)'\150', (byte)'\151', (byte)'\152', (byte)'\153', (byte)'\154', (byte)'\155', (byte)'\156', (byte)'\157',
96+
(byte)'\160', (byte)'\161', (byte)'\162', (byte)'\163', (byte)'\164', (byte)'\165', (byte)'\166', (byte)'\167',
97+
(byte)'\170', (byte)'\171', (byte)'\172', (byte)'\173', (byte)'\174', (byte)'\175', (byte)'\176', (byte)'\177',
98+
(byte)'\200', (byte)'\201', (byte)'\202', (byte)'\203', (byte)'\204', (byte)'\205', (byte)'\206', (byte)'\207',
99+
(byte)'\210', (byte)'\211', (byte)'\232', (byte)'\213', (byte)'\234', (byte)'\215', (byte)'\216', (byte)'\217',
100+
(byte)'\220', (byte)'\221', (byte)'\222', (byte)'\223', (byte)'\224', (byte)'\225', (byte)'\226', (byte)'\227',
101+
(byte)'\230', (byte)'\231', (byte)'\232', (byte)'\233', (byte)'\234', (byte)'\235', (byte)'\236', (byte)'\377',
102+
(byte)'\240', (byte)'\241', (byte)'\242', (byte)'\243', (byte)'\244', (byte)'\245', (byte)'\246', (byte)'\247',
103+
(byte)'\250', (byte)'\251', (byte)'\252', (byte)'\253', (byte)'\254', (byte)'\255', (byte)'\256', (byte)'\257',
104+
(byte)'\260', (byte)'\261', (byte)'\262', (byte)'\263', (byte)'\264', (byte)'\265', (byte)'\266', (byte)'\267',
105+
(byte)'\270', (byte)'\271', (byte)'\272', (byte)'\273', (byte)'\274', (byte)'\275', (byte)'\276', (byte)'\277',
106+
(byte)'\340', (byte)'\341', (byte)'\342', (byte)'\343', (byte)'\344', (byte)'\345', (byte)'\346', (byte)'\347',
107+
(byte)'\350', (byte)'\351', (byte)'\352', (byte)'\353', (byte)'\354', (byte)'\355', (byte)'\356', (byte)'\357',
108+
(byte)'\360', (byte)'\361', (byte)'\362', (byte)'\363', (byte)'\364', (byte)'\365', (byte)'\366', (byte)'\327',
109+
(byte)'\370', (byte)'\371', (byte)'\372', (byte)'\373', (byte)'\374', (byte)'\151', (byte)'\376', (byte)'\337',
110+
(byte)'\340', (byte)'\341', (byte)'\342', (byte)'\343', (byte)'\344', (byte)'\345', (byte)'\346', (byte)'\347',
111+
(byte)'\350', (byte)'\351', (byte)'\352', (byte)'\353', (byte)'\354', (byte)'\355', (byte)'\356', (byte)'\357',
112+
(byte)'\360', (byte)'\361', (byte)'\362', (byte)'\363', (byte)'\364', (byte)'\365', (byte)'\366', (byte)'\367',
113+
(byte)'\370', (byte)'\371', (byte)'\372', (byte)'\373', (byte)'\374', (byte)'\375', (byte)'\376', (byte)'\377'
114+
};
115+
116+
static final int CP1254_CaseFoldMap[][] = {
117+
{ 0xc0, 0xe0 },
118+
{ 0xc1, 0xe1 },
119+
{ 0xc2, 0xe2 },
120+
{ 0xc3, 0xe3 },
121+
{ 0xc4, 0xe4 },
122+
{ 0xc5, 0xe5 },
123+
{ 0xc6, 0xe6 },
124+
{ 0xc7, 0xe7 },
125+
{ 0xc8, 0xe8 },
126+
{ 0xc9, 0xe9 },
127+
{ 0xca, 0xea },
128+
{ 0xcb, 0xeb },
129+
{ 0xcc, 0xec },
130+
{ 0xcd, 0xed },
131+
{ 0xce, 0xee },
132+
{ 0xcf, 0xef },
133+
134+
{ 0xd0, 0xf0 },
135+
{ 0xd1, 0xf1 },
136+
{ 0xd2, 0xf2 },
137+
{ 0xd3, 0xf3 },
138+
{ 0xd4, 0xf4 },
139+
{ 0xd5, 0xf5 },
140+
{ 0xd6, 0xf6 },
141+
{ 0xd8, 0xf8 },
142+
{ 0xd9, 0xf9 },
143+
{ 0xda, 0xfa },
144+
{ 0xdb, 0xfb },
145+
{ 0xdc, 0xfc },
146+
{ 0xdd, 0xfd },
147+
{ 0xde, 0xfe }
148+
};
149+
150+
public static final Windows_1254Encoding INSTANCE = new Windows_1254Encoding();
151+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
/*
2+
* Permission is hereby granted, free of charge, to any person obtaining a copy of
3+
* this software and associated documentation files (the "Software"), to deal in
4+
* the Software without restriction, including without limitation the rights to
5+
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
6+
* of the Software, and to permit persons to whom the Software is furnished to do
7+
* so, subject to the following conditions:
8+
*
9+
* The above copyright notice and this permission notice shall be included in all
10+
* copies or substantial portions of the Software.
11+
*
12+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
15+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
16+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
17+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
18+
* SOFTWARE.
19+
*/
20+
package org.jcodings.specific;
21+
22+
import org.jcodings.CaseFoldMapEncoding;
23+
import org.jcodings.IntHolder;
24+
25+
final public class Windows_1257Encoding extends CaseFoldMapEncoding {
26+
27+
protected Windows_1257Encoding() {
28+
super("Windows-1257", CP1257_CtypeTable, CP1257_ToLowerCaseTable, CP1257_CaseFoldMap, true);
29+
}
30+
31+
@Override
32+
public int mbcCaseFold(int flag, byte[]bytes, IntHolder pp, int end, byte[]lower) {
33+
int p = pp.value;
34+
int lowerP = 0;
35+
36+
lower[lowerP] = LowerCaseTable[bytes[p] & 0xff];
37+
pp.value++;
38+
return 1;
39+
}
40+
41+
@Override
42+
public boolean isCodeCType(int code, int ctype) {
43+
return code < 256 ? isCodeCTypeInternal(code, ctype) : false;
44+
}
45+
46+
static final short CP1257_CtypeTable[] = {
47+
0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008,
48+
0x4008, 0x420c, 0x4209, 0x4208, 0x4208, 0x4208, 0x4008, 0x4008,
49+
0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008,
50+
0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008,
51+
0x4284, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0,
52+
0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0,
53+
0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0,
54+
0x78b0, 0x78b0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0,
55+
0x41a0, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x74a2,
56+
0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2,
57+
0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2,
58+
0x74a2, 0x74a2, 0x74a2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x51a0,
59+
0x41a0, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x70e2,
60+
0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2,
61+
0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2,
62+
0x70e2, 0x70e2, 0x70e2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x4008,
63+
0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008,
64+
0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008,
65+
0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008,
66+
0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008,
67+
0x0284, 0x01a0, 0x00a0, 0x00a0, 0x00a0, 0x01a0, 0x00a0, 0x00a0,
68+
0x34a2, 0x00a0, 0x34a2, 0x01a0, 0x00a0, 0x01a0, 0x00a0, 0x34a2,
69+
0x00a0, 0x00a0, 0x10a0, 0x10a0, 0x01a0, 0x30e2, 0x00a0, 0x01a0,
70+
0x30e2, 0x10a0, 0x30e2, 0x01a0, 0x10a0, 0x10a0, 0x10a0, 0x30e2,
71+
0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2,
72+
0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2,
73+
0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x00a0,
74+
0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x30e2,
75+
0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2,
76+
0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2,
77+
0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x00a0,
78+
0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x01a0
79+
};
80+
81+
static final byte CP1257_ToLowerCaseTable[] = new byte[]{
82+
(byte)'\000', (byte)'\001', (byte)'\002', (byte)'\003', (byte)'\004', (byte)'\005', (byte)'\006', (byte)'\007',
83+
(byte)'\010', (byte)'\011', (byte)'\012', (byte)'\013', (byte)'\014', (byte)'\015', (byte)'\016', (byte)'\017',
84+
(byte)'\020', (byte)'\021', (byte)'\022', (byte)'\023', (byte)'\024', (byte)'\025', (byte)'\026', (byte)'\027',
85+
(byte)'\030', (byte)'\031', (byte)'\032', (byte)'\033', (byte)'\034', (byte)'\035', (byte)'\036', (byte)'\037',
86+
(byte)'\040', (byte)'\041', (byte)'\042', (byte)'\043', (byte)'\044', (byte)'\045', (byte)'\046', (byte)'\047',
87+
(byte)'\050', (byte)'\051', (byte)'\052', (byte)'\053', (byte)'\054', (byte)'\055', (byte)'\056', (byte)'\057',
88+
(byte)'\060', (byte)'\061', (byte)'\062', (byte)'\063', (byte)'\064', (byte)'\065', (byte)'\066', (byte)'\067',
89+
(byte)'\070', (byte)'\071', (byte)'\072', (byte)'\073', (byte)'\074', (byte)'\075', (byte)'\076', (byte)'\077',
90+
(byte)'\100', (byte)'\141', (byte)'\142', (byte)'\143', (byte)'\144', (byte)'\145', (byte)'\146', (byte)'\147',
91+
(byte)'\150', (byte)'\151', (byte)'\152', (byte)'\153', (byte)'\154', (byte)'\155', (byte)'\156', (byte)'\157',
92+
(byte)'\160', (byte)'\161', (byte)'\162', (byte)'\163', (byte)'\164', (byte)'\165', (byte)'\166', (byte)'\167',
93+
(byte)'\170', (byte)'\171', (byte)'\172', (byte)'\133', (byte)'\134', (byte)'\135', (byte)'\136', (byte)'\137',
94+
(byte)'\140', (byte)'\141', (byte)'\142', (byte)'\143', (byte)'\144', (byte)'\145', (byte)'\146', (byte)'\147',
95+
(byte)'\150', (byte)'\151', (byte)'\152', (byte)'\153', (byte)'\154', (byte)'\155', (byte)'\156', (byte)'\157',
96+
(byte)'\160', (byte)'\161', (byte)'\162', (byte)'\163', (byte)'\164', (byte)'\165', (byte)'\166', (byte)'\167',
97+
(byte)'\170', (byte)'\171', (byte)'\172', (byte)'\173', (byte)'\174', (byte)'\175', (byte)'\176', (byte)'\177',
98+
(byte)'\200', (byte)'\201', (byte)'\202', (byte)'\203', (byte)'\204', (byte)'\205', (byte)'\206', (byte)'\207',
99+
(byte)'\210', (byte)'\211', (byte)'\212', (byte)'\213', (byte)'\214', (byte)'\215', (byte)'\216', (byte)'\217',
100+
(byte)'\220', (byte)'\221', (byte)'\222', (byte)'\223', (byte)'\224', (byte)'\225', (byte)'\226', (byte)'\227',
101+
(byte)'\230', (byte)'\231', (byte)'\232', (byte)'\233', (byte)'\234', (byte)'\235', (byte)'\236', (byte)'\237',
102+
(byte)'\240', (byte)'\241', (byte)'\242', (byte)'\243', (byte)'\244', (byte)'\245', (byte)'\246', (byte)'\247',
103+
(byte)'\270', (byte)'\251', (byte)'\272', (byte)'\253', (byte)'\254', (byte)'\255', (byte)'\256', (byte)'\277',
104+
(byte)'\260', (byte)'\261', (byte)'\262', (byte)'\263', (byte)'\264', (byte)'\265', (byte)'\266', (byte)'\267',
105+
(byte)'\270', (byte)'\271', (byte)'\272', (byte)'\273', (byte)'\274', (byte)'\275', (byte)'\276', (byte)'\277',
106+
(byte)'\340', (byte)'\341', (byte)'\342', (byte)'\343', (byte)'\344', (byte)'\345', (byte)'\346', (byte)'\347',
107+
(byte)'\350', (byte)'\351', (byte)'\352', (byte)'\353', (byte)'\354', (byte)'\355', (byte)'\356', (byte)'\357',
108+
(byte)'\360', (byte)'\361', (byte)'\362', (byte)'\363', (byte)'\364', (byte)'\365', (byte)'\366', (byte)'\327',
109+
(byte)'\370', (byte)'\371', (byte)'\372', (byte)'\373', (byte)'\374', (byte)'\375', (byte)'\376', (byte)'\337',
110+
(byte)'\340', (byte)'\341', (byte)'\342', (byte)'\343', (byte)'\344', (byte)'\345', (byte)'\346', (byte)'\347',
111+
(byte)'\350', (byte)'\351', (byte)'\352', (byte)'\353', (byte)'\354', (byte)'\355', (byte)'\356', (byte)'\357',
112+
(byte)'\360', (byte)'\361', (byte)'\362', (byte)'\363', (byte)'\364', (byte)'\365', (byte)'\366', (byte)'\367',
113+
(byte)'\370', (byte)'\371', (byte)'\372', (byte)'\373', (byte)'\374', (byte)'\375', (byte)'\376', (byte)'\377'
114+
};
115+
116+
static final int CP1257_CaseFoldMap[][] = {
117+
{ 0xa8, 0xb8 },
118+
{ 0xaa, 0xba },
119+
{ 0xaf, 0xbf },
120+
121+
{ 0xc0, 0xe0 },
122+
{ 0xc1, 0xe1 },
123+
{ 0xc2, 0xe2 },
124+
{ 0xc3, 0xe3 },
125+
{ 0xc4, 0xe4 },
126+
{ 0xc5, 0xe5 },
127+
{ 0xc6, 0xe6 },
128+
{ 0xc7, 0xe7 },
129+
{ 0xc8, 0xe8 },
130+
{ 0xc9, 0xe9 },
131+
{ 0xca, 0xea },
132+
{ 0xcb, 0xeb },
133+
{ 0xcc, 0xec },
134+
{ 0xcd, 0xed },
135+
{ 0xce, 0xee },
136+
{ 0xcf, 0xef },
137+
138+
{ 0xd0, 0xf0 },
139+
{ 0xd1, 0xf1 },
140+
{ 0xd2, 0xf2 },
141+
{ 0xd3, 0xf3 },
142+
{ 0xd4, 0xf4 },
143+
{ 0xd5, 0xf5 },
144+
{ 0xd6, 0xf6 },
145+
{ 0xd8, 0xf8 },
146+
{ 0xd9, 0xf9 },
147+
{ 0xda, 0xfa },
148+
{ 0xdb, 0xfb },
149+
{ 0xdc, 0xfc },
150+
{ 0xdd, 0xfd },
151+
{ 0xde, 0xfe }
152+
};
153+
154+
public static final Windows_1257Encoding INSTANCE = new Windows_1257Encoding();
155+
}

0 commit comments

Comments
 (0)
Please sign in to comment.