2 * CP20866.cs - Cyrillic (KOI8-R) code page.
4 * Copyright (c) 2002 Southern Storm Software, Pty Ltd
6 * Permission is hereby granted, free of charge, to any person obtaining
7 * a copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
13 * The above copyright notice and this permission notice shall be included
14 * in all copies or substantial portions of the Software.
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22 * OTHER DEALINGS IN THE SOFTWARE.
25 // Generated from "ibm-878.ucm".
35 public class CP20866
: ByteEncoding
38 : base(20866, ToChars
, "Cyrillic (KOI8-R)",
39 "koi8-r", "koi8-r", "koi8-r",
40 true, true, true, true, 1251)
43 private static readonly char[] ToChars
= {
44 '\u0000', '\u0001', '\u0002', '\u0003', '\u0004', '\u0005',
45 '\u0006', '\u0007', '\u0008', '\u0009', '\u000A', '\u000B',
46 '\u000C', '\u000D', '\u000E', '\u000F', '\u0010', '\u0011',
47 '\u0012', '\u0013', '\u0014', '\u0015', '\u0016', '\u0017',
48 '\u0018', '\u0019', '\u001A', '\u001B', '\u001C', '\u001D',
49 '\u001E', '\u001F', '\u0020', '\u0021', '\u0022', '\u0023',
50 '\u0024', '\u0025', '\u0026', '\u0027', '\u0028', '\u0029',
51 '\u002A', '\u002B', '\u002C', '\u002D', '\u002E', '\u002F',
52 '\u0030', '\u0031', '\u0032', '\u0033', '\u0034', '\u0035',
53 '\u0036', '\u0037', '\u0038', '\u0039', '\u003A', '\u003B',
54 '\u003C', '\u003D', '\u003E', '\u003F', '\u0040', '\u0041',
55 '\u0042', '\u0043', '\u0044', '\u0045', '\u0046', '\u0047',
56 '\u0048', '\u0049', '\u004A', '\u004B', '\u004C', '\u004D',
57 '\u004E', '\u004F', '\u0050', '\u0051', '\u0052', '\u0053',
58 '\u0054', '\u0055', '\u0056', '\u0057', '\u0058', '\u0059',
59 '\u005A', '\u005B', '\u005C', '\u005D', '\u005E', '\u005F',
60 '\u0060', '\u0061', '\u0062', '\u0063', '\u0064', '\u0065',
61 '\u0066', '\u0067', '\u0068', '\u0069', '\u006A', '\u006B',
62 '\u006C', '\u006D', '\u006E', '\u006F', '\u0070', '\u0071',
63 '\u0072', '\u0073', '\u0074', '\u0075', '\u0076', '\u0077',
64 '\u0078', '\u0079', '\u007A', '\u007B', '\u007C', '\u007D',
65 '\u007E', '\u007F', '\u2500', '\u2502', '\u250C', '\u2510',
66 '\u2514', '\u2518', '\u251C', '\u2524', '\u252C', '\u2534',
67 '\u253C', '\u2580', '\u2584', '\u2588', '\u258C', '\u2590',
68 '\u2591', '\u2592', '\u2593', '\u2320', '\u25A0', '\u2219',
69 '\u221A', '\u2248', '\u2264', '\u2265', '\u00A0', '\u2321',
70 '\u00B0', '\u00B2', '\u00B7', '\u00F7', '\u2550', '\u2551',
71 '\u2552', '\u0451', '\u2553', '\u2554', '\u2555', '\u2556',
72 '\u2557', '\u2558', '\u2559', '\u255A', '\u255B', '\u255C',
73 '\u255D', '\u255E', '\u255F', '\u2560', '\u2561', '\u0401',
74 '\u2562', '\u2563', '\u2564', '\u2565', '\u2566', '\u2567',
75 '\u2568', '\u2569', '\u256A', '\u256B', '\u256C', '\u00A9',
76 '\u044E', '\u0430', '\u0431', '\u0446', '\u0434', '\u0435',
77 '\u0444', '\u0433', '\u0445', '\u0438', '\u0439', '\u043A',
78 '\u043B', '\u043C', '\u043D', '\u043E', '\u043F', '\u044F',
79 '\u0440', '\u0441', '\u0442', '\u0443', '\u0436', '\u0432',
80 '\u044C', '\u044B', '\u0437', '\u0448', '\u044D', '\u0449',
81 '\u0447', '\u044A', '\u042E', '\u0410', '\u0411', '\u0426',
82 '\u0414', '\u0415', '\u0424', '\u0413', '\u0425', '\u0418',
83 '\u0419', '\u041A', '\u041B', '\u041C', '\u041D', '\u041E',
84 '\u041F', '\u042F', '\u0420', '\u0421', '\u0422', '\u0423',
85 '\u0416', '\u0412', '\u042C', '\u042B', '\u0417', '\u0428',
86 '\u042D', '\u0429', '\u0427', '\u042A',
89 protected unsafe override void ToBytes(char* chars
, int charCount
,
90 byte* bytes
, int byteCount
)
96 EncoderFallbackBuffer buffer
= null;
100 ch
= (int)(chars
[charIndex
++]);
101 if(ch
>= 128) switch(ch
)
103 case 0x00A0: ch
= 0x9A; break;
104 case 0x00A9: ch
= 0xBF; break;
105 case 0x00B0: ch
= 0x9C; break;
106 case 0x00B2: ch
= 0x9D; break;
107 case 0x00B7: ch
= 0x9E; break;
108 case 0x00F7: ch
= 0x9F; break;
109 case 0x0401: ch
= 0xB3; break;
110 case 0x0410: ch
= 0xE1; break;
111 case 0x0411: ch
= 0xE2; break;
112 case 0x0412: ch
= 0xF7; break;
113 case 0x0413: ch
= 0xE7; break;
114 case 0x0414: ch
= 0xE4; break;
115 case 0x0415: ch
= 0xE5; break;
116 case 0x0416: ch
= 0xF6; break;
117 case 0x0417: ch
= 0xFA; break;
134 case 0x0424: ch
= 0xE6; break;
135 case 0x0425: ch
= 0xE8; break;
136 case 0x0426: ch
= 0xE3; break;
137 case 0x0427: ch
= 0xFE; break;
138 case 0x0428: ch
= 0xFB; break;
139 case 0x0429: ch
= 0xFD; break;
140 case 0x042A: ch
= 0xFF; break;
141 case 0x042B: ch
= 0xF9; break;
142 case 0x042C: ch
= 0xF8; break;
143 case 0x042D: ch
= 0xFC; break;
144 case 0x042E: ch
= 0xE0; break;
145 case 0x042F: ch
= 0xF1; break;
146 case 0x0430: ch
= 0xC1; break;
147 case 0x0431: ch
= 0xC2; break;
148 case 0x0432: ch
= 0xD7; break;
149 case 0x0433: ch
= 0xC7; break;
150 case 0x0434: ch
= 0xC4; break;
151 case 0x0435: ch
= 0xC5; break;
152 case 0x0436: ch
= 0xD6; break;
153 case 0x0437: ch
= 0xDA; break;
170 case 0x0444: ch
= 0xC6; break;
171 case 0x0445: ch
= 0xC8; break;
172 case 0x0446: ch
= 0xC3; break;
173 case 0x0447: ch
= 0xDE; break;
174 case 0x0448: ch
= 0xDB; break;
175 case 0x0449: ch
= 0xDD; break;
176 case 0x044A: ch
= 0xDF; break;
177 case 0x044B: ch
= 0xD9; break;
178 case 0x044C: ch
= 0xD8; break;
179 case 0x044D: ch
= 0xDC; break;
180 case 0x044E: ch
= 0xC0; break;
181 case 0x044F: ch
= 0xD1; break;
182 case 0x0451: ch
= 0xA3; break;
183 case 0x2219: ch
= 0x95; break;
184 case 0x221A: ch
= 0x96; break;
185 case 0x2248: ch
= 0x97; break;
186 case 0x2264: ch
= 0x98; break;
187 case 0x2265: ch
= 0x99; break;
188 case 0x2320: ch
= 0x93; break;
189 case 0x2321: ch
= 0x9B; break;
190 case 0x2500: ch
= 0x80; break;
191 case 0x2502: ch
= 0x81; break;
192 case 0x250C: ch
= 0x82; break;
193 case 0x2510: ch
= 0x83; break;
194 case 0x2514: ch
= 0x84; break;
195 case 0x2518: ch
= 0x85; break;
196 case 0x251C: ch
= 0x86; break;
197 case 0x2524: ch
= 0x87; break;
198 case 0x252C: ch
= 0x88; break;
199 case 0x2534: ch
= 0x89; break;
200 case 0x253C: ch
= 0x8A; break;
201 case 0x2550: ch
= 0xA0; break;
202 case 0x2551: ch
= 0xA1; break;
203 case 0x2552: ch
= 0xA2; break;
234 case 0x2580: ch
= 0x8B; break;
235 case 0x2584: ch
= 0x8C; break;
236 case 0x2588: ch
= 0x8D; break;
237 case 0x258C: ch
= 0x8E; break;
244 case 0x25A0: ch
= 0x94; break;
245 case 0xFFE8: ch
= 0x81; break;
246 case 0xFFED: ch
= 0x94; break;
249 if(ch
>= 0xFF01 && ch
<= 0xFF5E)
253 HandleFallback (ref buffer
, chars
, ref charIndex
, ref charCount
, bytes
, ref byteIndex
, ref byteCount
);
260 bytes
[byteIndex
++] = (byte)ch
;
267 protected override void ToBytes(String s, int charIndex, int charCount,
268 byte[] bytes, int byteIndex)
273 ch = (int)(s[charIndex++]);
274 if(ch >= 128) switch(ch)
276 case 0x00A0: ch = 0x9A; break;
277 case 0x00A9: ch = 0xBF; break;
278 case 0x00B0: ch = 0x9C; break;
279 case 0x00B2: ch = 0x9D; break;
280 case 0x00B7: ch = 0x9E; break;
281 case 0x00F7: ch = 0x9F; break;
282 case 0x0401: ch = 0xB3; break;
283 case 0x0410: ch = 0xE1; break;
284 case 0x0411: ch = 0xE2; break;
285 case 0x0412: ch = 0xF7; break;
286 case 0x0413: ch = 0xE7; break;
287 case 0x0414: ch = 0xE4; break;
288 case 0x0415: ch = 0xE5; break;
289 case 0x0416: ch = 0xF6; break;
290 case 0x0417: ch = 0xFA; break;
307 case 0x0424: ch = 0xE6; break;
308 case 0x0425: ch = 0xE8; break;
309 case 0x0426: ch = 0xE3; break;
310 case 0x0427: ch = 0xFE; break;
311 case 0x0428: ch = 0xFB; break;
312 case 0x0429: ch = 0xFD; break;
313 case 0x042A: ch = 0xFF; break;
314 case 0x042B: ch = 0xF9; break;
315 case 0x042C: ch = 0xF8; break;
316 case 0x042D: ch = 0xFC; break;
317 case 0x042E: ch = 0xE0; break;
318 case 0x042F: ch = 0xF1; break;
319 case 0x0430: ch = 0xC1; break;
320 case 0x0431: ch = 0xC2; break;
321 case 0x0432: ch = 0xD7; break;
322 case 0x0433: ch = 0xC7; break;
323 case 0x0434: ch = 0xC4; break;
324 case 0x0435: ch = 0xC5; break;
325 case 0x0436: ch = 0xD6; break;
326 case 0x0437: ch = 0xDA; break;
343 case 0x0444: ch = 0xC6; break;
344 case 0x0445: ch = 0xC8; break;
345 case 0x0446: ch = 0xC3; break;
346 case 0x0447: ch = 0xDE; break;
347 case 0x0448: ch = 0xDB; break;
348 case 0x0449: ch = 0xDD; break;
349 case 0x044A: ch = 0xDF; break;
350 case 0x044B: ch = 0xD9; break;
351 case 0x044C: ch = 0xD8; break;
352 case 0x044D: ch = 0xDC; break;
353 case 0x044E: ch = 0xC0; break;
354 case 0x044F: ch = 0xD1; break;
355 case 0x0451: ch = 0xA3; break;
356 case 0x2219: ch = 0x95; break;
357 case 0x221A: ch = 0x96; break;
358 case 0x2248: ch = 0x97; break;
359 case 0x2264: ch = 0x98; break;
360 case 0x2265: ch = 0x99; break;
361 case 0x2320: ch = 0x93; break;
362 case 0x2321: ch = 0x9B; break;
363 case 0x2500: ch = 0x80; break;
364 case 0x2502: ch = 0x81; break;
365 case 0x250C: ch = 0x82; break;
366 case 0x2510: ch = 0x83; break;
367 case 0x2514: ch = 0x84; break;
368 case 0x2518: ch = 0x85; break;
369 case 0x251C: ch = 0x86; break;
370 case 0x2524: ch = 0x87; break;
371 case 0x252C: ch = 0x88; break;
372 case 0x2534: ch = 0x89; break;
373 case 0x253C: ch = 0x8A; break;
374 case 0x2550: ch = 0xA0; break;
375 case 0x2551: ch = 0xA1; break;
376 case 0x2552: ch = 0xA2; break;
407 case 0x2580: ch = 0x8B; break;
408 case 0x2584: ch = 0x8C; break;
409 case 0x2588: ch = 0x8D; break;
410 case 0x258C: ch = 0x8E; break;
417 case 0x25A0: ch = 0x94; break;
418 case 0xFFE8: ch = 0x81; break;
419 case 0xFFED: ch = 0x94; break;
422 if(ch >= 0xFF01 && ch <= 0xFF5E)
429 bytes[byteIndex++] = (byte)ch;
438 public class ENCkoi8_r
: CP20866
440 public ENCkoi8_r() : base() {}
442 }; // class ENCkoi8_r
444 }; // namespace I18N.Other