2 * CP874.cs - Thai (Windows) 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-874.ucm".
35 public class CP874
: ByteEncoding
38 : base(874, ToChars
, "Thai (Windows)",
39 "windows-874", "windows-874", "windows-874",
40 true, true, true, true, 874)
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', '\u001C', '\u001B', '\u007F', '\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', '\u001A', '\u003F', '\u003F', '\u003F', '\u003F',
66 '\u003F', '\u003F', '\u003F', '\u003F', '\u003F', '\u003F',
67 '\u003F', '\u003F', '\u003F', '\u003F', '\u003F', '\u003F',
68 '\u003F', '\u003F', '\u003F', '\u003F', '\u003F', '\u003F',
69 '\u003F', '\u003F', '\u003F', '\u003F', '\u003F', '\u003F',
70 '\u003F', '\u003F', '\u003F', '\u003F', '\u0E48', '\u0E01',
71 '\u0E02', '\u0E03', '\u0E04', '\u0E05', '\u0E06', '\u0E07',
72 '\u0E08', '\u0E09', '\u0E0A', '\u0E0B', '\u0E0C', '\u0E0D',
73 '\u0E0E', '\u0E0F', '\u0E10', '\u0E11', '\u0E12', '\u0E13',
74 '\u0E14', '\u0E15', '\u0E16', '\u0E17', '\u0E18', '\u0E19',
75 '\u0E1A', '\u0E1B', '\u0E1C', '\u0E1D', '\u0E1E', '\u0E1F',
76 '\u0E20', '\u0E21', '\u0E22', '\u0E23', '\u0E24', '\u0E25',
77 '\u0E26', '\u0E27', '\u0E28', '\u0E29', '\u0E2A', '\u0E2B',
78 '\u0E2C', '\u0E2D', '\u0E2E', '\u0E2F', '\u0E30', '\u0E31',
79 '\u0E32', '\u0E33', '\u0E34', '\u0E35', '\u0E36', '\u0E37',
80 '\u0E38', '\u0E39', '\u0E3A', '\u0E49', '\u0E4A', '\u0E4B',
81 '\u0E4C', '\u0E3F', '\u0E40', '\u0E41', '\u0E42', '\u0E43',
82 '\u0E44', '\u0E45', '\u0E46', '\u0E47', '\u0E48', '\u0E49',
83 '\u0E4A', '\u0E4B', '\u0E4C', '\u0E4D', '\u0E4E', '\u0E4F',
84 '\u0E50', '\u0E51', '\u0E52', '\u0E53', '\u0E54', '\u0E55',
85 '\u0E56', '\u0E57', '\u0E58', '\u0E59', '\u0E5A', '\u0E5B',
86 '\u00A2', '\u00AC', '\u00A6', '\u00A0',
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
>= 26) switch(ch
)
203 case 0x001A: ch
= 0x7F; break;
204 case 0x001C: ch
= 0x1A; break;
205 case 0x007F: ch
= 0x1C; break;
206 case 0x00A0: ch
= 0xFF; break;
207 case 0x00A2: ch
= 0xFC; break;
208 case 0x00A6: ch
= 0xFE; break;
209 case 0x00AC: ch
= 0xFD; break;
303 if(ch
>= 0xFF01 && ch
<= 0xFF5E)
307 HandleFallback (ref buffer
, chars
, ref charIndex
, ref charCount
, bytes
, ref byteIndex
, ref byteCount
);
314 bytes
[byteIndex
++] = (byte)ch
;
321 protected override void ToBytes(String s, int charIndex, int charCount,
322 byte[] bytes, int byteIndex)
327 ch = (int)(s[charIndex++]);
328 if(ch >= 26) switch(ch)
430 case 0x001A: ch = 0x7F; break;
431 case 0x001C: ch = 0x1A; break;
432 case 0x007F: ch = 0x1C; break;
433 case 0x00A0: ch = 0xFF; break;
434 case 0x00A2: ch = 0xFC; break;
435 case 0x00A6: ch = 0xFE; break;
436 case 0x00AC: ch = 0xFD; break;
530 if(ch >= 0xFF01 && ch <= 0xFF5E)
537 bytes[byteIndex++] = (byte)ch;
546 public class ENCwindows_874
: CP874
548 public ENCwindows_874() : base() {}
550 }; // class ENCwindows_874
552 }; // namespace I18N.Other