| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
namespace I18N.CJK |
| 54 |
{ |
| 55 |
|
| 56 |
using System; |
| 57 |
using System.Text; |
| 58 |
using I18N.Common; |
| 59 |
|
| 60 |
#if DISABLE_UNSAFE |
| 61 |
using MonoEncoder = I18N.Common.MonoSafeEncoder; |
| 62 |
using MonoEncoding = I18N.Common.MonoSafeEncoding; |
| 63 |
#endif |
| 64 |
|
| 65 |
[Serializable] |
| 66 |
public class CP51932 : MonoEncoding |
| 67 |
{ |
| 68 |
|
| 69 |
private const int EUC_JP_CODE_PAGE = 51932; |
| 70 |
|
| 71 |
|
| 72 |
public CP51932 () : base (EUC_JP_CODE_PAGE, 932) |
| 73 |
{ |
| 74 |
} |
| 75 |
|
| 76 |
#if !DISABLE_UNSAFE |
| 77 |
public unsafe override int GetByteCountImpl (char* chars, int count) |
| 78 |
{ |
| 79 |
return new CP51932Encoder (this).GetByteCountImpl (chars, count, true); |
| 80 |
} |
| 81 |
|
| 82 |
public unsafe override int GetBytesImpl (char* chars, int charCount, byte* bytes, int byteCount) |
| 83 |
{ |
| 84 |
return new CP51932Encoder (this).GetBytesImpl (chars, charCount, bytes, byteCount, true); |
| 85 |
} |
| 86 |
#else |
| 87 |
public override int GetByteCount (char [] chars, int index, int length) |
| 88 |
{ |
| 89 |
return new CP51932Encoder (this).GetByteCount (chars, index, length, true); |
| 90 |
} |
| 91 |
|
| 92 |
public override int GetBytes(char[] chars, int charIndex, int charCount, byte[] bytes, int byteIndex) |
| 93 |
{ |
| 94 |
return new CP51932Encoder (this).GetBytes (chars, charIndex, charCount, bytes, byteIndex, true); |
| 95 |
} |
| 96 |
#endif |
| 97 |
|
| 98 |
public override int GetCharCount (byte [] bytes, int index, int count) |
| 99 |
{ |
| 100 |
return new CP51932Decoder ().GetCharCount ( |
| 101 |
bytes, index, count, true); |
| 102 |
} |
| 103 |
|
| 104 |
public override int GetChars ( |
| 105 |
byte [] bytes, int byteIndex, int byteCount, |
| 106 |
char [] chars, int charIndex) |
| 107 |
{ |
| 108 |
return new CP51932Decoder ().GetChars (bytes, |
| 109 |
byteIndex, byteCount, chars, charIndex, true); |
| 110 |
} |
| 111 |
|
| 112 |
|
| 113 |
|
| 114 |
public override int GetMaxByteCount(int charCount) |
| 115 |
{ |
| 116 |
if(charCount < 0) |
| 117 |
{ |
| 118 |
throw new ArgumentOutOfRangeException |
| 119 |
("charCount", |
| 120 |
Strings.GetString("ArgRange_NonNegative")); |
| 121 |
} |
| 122 |
return charCount * 3; |
| 123 |
} |
| 124 |
|
| 125 |
|
| 126 |
|
| 127 |
public override int GetMaxCharCount(int byteCount) |
| 128 |
{ |
| 129 |
if(byteCount < 0) |
| 130 |
{ |
| 131 |
throw new ArgumentOutOfRangeException |
| 132 |
("byteCount", |
| 133 |
Strings.GetString ("ArgRange_NonNegative")); |
| 134 |
} |
| 135 |
return byteCount; |
| 136 |
} |
| 137 |
|
| 138 |
public override Encoder GetEncoder () |
| 139 |
{ |
| 140 |
return new CP51932Encoder (this); |
| 141 |
} |
| 142 |
|
| 143 |
public override Decoder GetDecoder () |
| 144 |
{ |
| 145 |
return new CP51932Decoder (); |
| 146 |
} |
| 147 |
|
| 148 |
#if !ECMA_COMPAT |
| 149 |
|
| 150 |
|
| 151 |
public override String BodyName { |
| 152 |
get { return "euc-jp"; } |
| 153 |
} |
| 154 |
|
| 155 |
|
| 156 |
public override String EncodingName { |
| 157 |
get { return "Japanese (EUC)"; } |
| 158 |
} |
| 159 |
|
| 160 |
|
| 161 |
public override String HeaderName { |
| 162 |
get { return "euc-jp"; } |
| 163 |
} |
| 164 |
|
| 165 |
|
| 166 |
public override bool IsBrowserDisplay { |
| 167 |
get { return true; } |
| 168 |
} |
| 169 |
|
| 170 |
|
| 171 |
public override bool IsBrowserSave { |
| 172 |
get { return true; } |
| 173 |
} |
| 174 |
|
| 175 |
|
| 176 |
public override bool IsMailNewsDisplay { |
| 177 |
get { return true; } |
| 178 |
} |
| 179 |
|
| 180 |
|
| 181 |
public override bool IsMailNewsSave { |
| 182 |
get { return true; } |
| 183 |
} |
| 184 |
|
| 185 |
|
| 186 |
public override String WebName { |
| 187 |
get { return "euc-jp"; } |
| 188 |
} |
| 189 |
} |
| 190 |
#endif |
| 191 |
|
| 192 |
public class CP51932Encoder : MonoEncoder |
| 193 |
{ |
| 194 |
public CP51932Encoder (MonoEncoding encoding) |
| 195 |
: base (encoding) |
| 196 |
{ |
| 197 |
} |
| 198 |
|
| 199 |
#if !DISABLE_UNSAFE |
| 200 |
|
| 201 |
public unsafe override int GetByteCountImpl ( |
| 202 |
char* chars, int count, bool refresh) |
| 203 |
{ |
| 204 |
|
| 205 |
int index = 0; |
| 206 |
int length = 0; |
| 207 |
int ch, value; |
| 208 |
byte [] cjkToJis = JISConvert.Convert.cjkToJis; |
| 209 |
byte [] extraToJis = JISConvert.Convert.extraToJis; |
| 210 |
|
| 211 |
while (count > 0) { |
| 212 |
ch = chars [index++]; |
| 213 |
--count; |
| 214 |
++length; |
| 215 |
if (ch < 0x0080) { |
| 216 |
|
| 217 |
continue; |
| 218 |
} else if (ch < 0x0100) { |
| 219 |
|
| 220 |
|
| 221 |
if(ch == 0x00A2 || ch == 0x00A3 || ch == 0x00A7 || |
| 222 |
ch == 0x00A8 || ch == 0x00AC || ch == 0x00B0 || |
| 223 |
ch == 0x00B1 || ch == 0x00B4 || ch == 0x00B6 || |
| 224 |
ch == 0x00D7 || ch == 0x00F7) |
| 225 |
{ |
| 226 |
++length; |
| 227 |
} |
| 228 |
} else if (ch >= 0x0391 && ch <= 0x0451) { |
| 229 |
|
| 230 |
++length; |
| 231 |
} else if (ch >= 0x2010 && ch <= 0x9FA5) { |
| 232 |
|
| 233 |
value = (ch - 0x2010) * 2; |
| 234 |
value = ((int) (cjkToJis[value])) | (((int)(cjkToJis[value + 1])) << 8); |
| 235 |
if(value >= 0x0100) |
| 236 |
++length; |
| 237 |
} else if(ch >= 0xFF01 && ch < 0xFF60) { |
| 238 |
|
| 239 |
value = (ch - 0xFF01) * 2; |
| 240 |
value = ((int)(extraToJis[value])) | |
| 241 |
(((int)(extraToJis[value + 1])) << 8); |
| 242 |
if(value >= 0x0100) |
| 243 |
++length; |
| 244 |
} else if(ch >= 0xFF60 && ch <= 0xFFA0) { |
| 245 |
++length; |
| 246 |
} |
| 247 |
} |
| 248 |
|
| 249 |
|
| 250 |
return length; |
| 251 |
} |
| 252 |
|
| 253 |
|
| 254 |
public unsafe override int GetBytesImpl ( |
| 255 |
char* chars, int charCount, byte* bytes, int byteCount, bool refresh) |
| 256 |
{ |
| 257 |
int charIndex = 0; |
| 258 |
int byteIndex = 0; |
| 259 |
int end = charCount; |
| 260 |
|
| 261 |
|
| 262 |
int posn = byteIndex; |
| 263 |
int byteLength = byteCount; |
| 264 |
int ch, value; |
| 265 |
|
| 266 |
byte[] cjkToJis = JISConvert.Convert.cjkToJis; |
| 267 |
byte[] greekToJis = JISConvert.Convert.greekToJis; |
| 268 |
byte[] extraToJis = JISConvert.Convert.extraToJis; |
| 269 |
|
| 270 |
for (int i = charIndex; i < end; i++, charCount--) { |
| 271 |
ch = chars [i]; |
| 272 |
if (posn >= byteLength) { |
| 273 |
throw new ArgumentException (Strings.GetString ("Arg_InsufficientSpace"), "bytes"); |
| 274 |
} |
| 275 |
|
| 276 |
if (ch < 0x0080) { |
| 277 |
|
| 278 |
bytes[posn++] = (byte)ch; |
| 279 |
continue; |
| 280 |
} else if (ch >= 0x0391 && ch <= 0x0451) { |
| 281 |
|
| 282 |
value = (ch - 0x0391) * 2; |
| 283 |
value = ((int)(greekToJis[value])) | |
| 284 |
(((int)(greekToJis[value + 1])) << 8); |
| 285 |
} else if (ch >= 0x2010 && ch <= 0x9FA5) { |
| 286 |
|
| 287 |
value = (ch - 0x2010) * 2; |
| 288 |
value = ((int) (cjkToJis[value])) | |
| 289 |
(((int)(cjkToJis[value + 1])) << 8); |
| 290 |
} else if (ch >= 0xFF01 && ch <= 0xFF60) { |
| 291 |
|
| 292 |
|
| 293 |
value = (ch - 0xFF01) * 2; |
| 294 |
value = ((int) (extraToJis [value])) | |
| 295 |
(((int) (extraToJis [value + 1])) << 8); |
| 296 |
} else if (ch >= 0xFF60 && ch <= 0xFFA0) { |
| 297 |
value = ch - 0xFF60 + 0x8EA0; |
| 298 |
} else { |
| 299 |
|
| 300 |
value = 0; |
| 301 |
} |
| 302 |
|
| 303 |
if (value == 0) { |
| 304 |
HandleFallback ( |
| 305 |
chars, ref i, ref charCount, |
| 306 |
bytes, ref posn, ref byteCount, null); |
| 307 |
} else if (value < 0x0100) { |
| 308 |
bytes [posn++] = (byte) value; |
| 309 |
} else if ((posn + 1) >= byteLength) { |
| 310 |
throw new ArgumentException (Strings.GetString ("Arg_InsufficientSpace"), "bytes"); |
| 311 |
} else if (value < 0x8000) { |
| 312 |
|
| 313 |
value -= 0x0100; |
| 314 |
bytes [posn++] = (byte) (value / 0x5E + 0xA1); |
| 315 |
bytes [posn++] = (byte) (value % 0x5E + 0xA1); |
| 316 |
|
| 317 |
continue; |
| 318 |
} |
| 319 |
else |
| 320 |
{ |
| 321 |
|
| 322 |
bytes [posn++] = 0x8E; |
| 323 |
bytes [posn++] = (byte) (value - 0x8E00); |
| 324 |
} |
| 325 |
} |
| 326 |
|
| 327 |
|
| 328 |
return posn - byteIndex; |
| 329 |
} |
| 330 |
#else |
| 331 |
|
| 332 |
public override int GetByteCount(char[] chars, int index, int count, bool flush) |
| 333 |
{ |
| 334 |
|
| 335 |
int length = 0; |
| 336 |
int ch, value; |
| 337 |
byte[] cjkToJis = JISConvert.Convert.cjkToJis; |
| 338 |
byte[] extraToJis = JISConvert.Convert.extraToJis; |
| 339 |
|
| 340 |
while (count > 0) |
| 341 |
{ |
| 342 |
ch = chars[index++]; |
| 343 |
--count; |
| 344 |
++length; |
| 345 |
if (ch < 0x0080) |
| 346 |
{ |
| 347 |
|
| 348 |
continue; |
| 349 |
} |
| 350 |
else if (ch < 0x0100) |
| 351 |
{ |
| 352 |
|
| 353 |
|
| 354 |
if (ch == 0x00A2 || ch == 0x00A3 || ch == 0x00A7 || |
| 355 |
ch == 0x00A8 || ch == 0x00AC || ch == 0x00B0 || |
| 356 |
ch == 0x00B1 || ch == 0x00B4 || ch == 0x00B6 || |
| 357 |
ch == 0x00D7 || ch == 0x00F7) |
| 358 |
{ |
| 359 |
++length; |
| 360 |
} |
| 361 |
} |
| 362 |
else if (ch >= 0x0391 && ch <= 0x0451) |
| 363 |
{ |
| 364 |
|
| 365 |
++length; |
| 366 |
} |
| 367 |
else if (ch >= 0x2010 && ch <= 0x9FA5) |
| 368 |
{ |
| 369 |
|
| 370 |
value = (ch - 0x2010) * 2; |
| 371 |
value = ((int)(cjkToJis[value])) | (((int)(cjkToJis[value + 1])) << 8); |
| 372 |
if (value >= 0x0100) |
| 373 |
++length; |
| 374 |
} |
| 375 |
else if (ch >= 0xFF01 && ch < 0xFF60) |
| 376 |
{ |
| 377 |
|
| 378 |
value = (ch - 0xFF01) * 2; |
| 379 |
value = ((int)(extraToJis[value])) | |
| 380 |
(((int)(extraToJis[value + 1])) << 8); |
| 381 |
if (value >= 0x0100) |
| 382 |
++length; |
| 383 |
} |
| 384 |
else if (ch >= 0xFF60 && ch <= 0xFFA0) |
| 385 |
{ |
| 386 |
++length; |
| 387 |
} |
| 388 |
} |
| 389 |
|
| 390 |
|
| 391 |
return length; |
| 392 |
} |
| 393 |
|
| 394 |
|
| 395 |
public override int GetBytes(char[] chars, int charIndex, int charCount, byte[] bytes, int byteIndex, bool flush) |
| 396 |
{ |
| 397 |
|
| 398 |
int posn = byteIndex; |
| 399 |
int byteLength = bytes.Length; |
| 400 |
int byteCount = bytes.Length; |
| 401 |
int end = charIndex + charCount; |
| 402 |
int ch, value; |
| 403 |
|
| 404 |
byte[] cjkToJis = JISConvert.Convert.cjkToJis; |
| 405 |
byte[] greekToJis = JISConvert.Convert.greekToJis; |
| 406 |
byte[] extraToJis = JISConvert.Convert.extraToJis; |
| 407 |
|
| 408 |
for (int i = charIndex; i < end; i++, charCount--) |
| 409 |
{ |
| 410 |
ch = chars[i]; |
| 411 |
if (posn >= byteLength) |
| 412 |
{ |
| 413 |
throw new ArgumentException(Strings.GetString("Arg_InsufficientSpace"), "bytes"); |
| 414 |
} |
| 415 |
|
| 416 |
if (ch < 0x0080) |
| 417 |
{ |
| 418 |
|
| 419 |
bytes[posn++] = (byte)ch; |
| 420 |
continue; |
| 421 |
} |
| 422 |
else if (ch >= 0x0391 && ch <= 0x0451) |
| 423 |
{ |
| 424 |
|
| 425 |
value = (ch - 0x0391) * 2; |
| 426 |
value = ((int)(greekToJis[value])) | |
| 427 |
(((int)(greekToJis[value + 1])) << 8); |
| 428 |
} |
| 429 |
else if (ch >= 0x2010 && ch <= 0x9FA5) |
| 430 |
{ |
| 431 |
|
| 432 |
value = (ch - 0x2010) * 2; |
| 433 |
value = ((int)(cjkToJis[value])) | |
| 434 |
(((int)(cjkToJis[value + 1])) << 8); |
| 435 |
} |
| 436 |
else if (ch >= 0xFF01 && ch <= 0xFF60) |
| 437 |
{ |
| 438 |
|
| 439 |
|
| 440 |
value = (ch - 0xFF01) * 2; |
| 441 |
value = ((int)(extraToJis[value])) | |
| 442 |
(((int)(extraToJis[value + 1])) << 8); |
| 443 |
} |
| 444 |
else if (ch >= 0xFF60 && ch <= 0xFFA0) |
| 445 |
{ |
| 446 |
value = ch - 0xFF60 + 0x8EA0; |
| 447 |
} |
| 448 |
else |
| 449 |
{ |
| 450 |
|
| 451 |
value = 0; |
| 452 |
} |
| 453 |
|
| 454 |
if (value == 0) |
| 455 |
{ |
| 456 |
HandleFallback (chars, ref i, ref charCount, |
| 457 |
bytes, ref posn, ref byteCount, null); |
| 458 |
} |
| 459 |
else if (value < 0x0100) |
| 460 |
{ |
| 461 |
bytes[posn++] = (byte)value; |
| 462 |
} |
| 463 |
else if ((posn + 1) >= byteLength) |
| 464 |
{ |
| 465 |
throw new ArgumentException(Strings.GetString("Arg_InsufficientSpace"), "bytes"); |
| 466 |
} |
| 467 |
else if (value < 0x8000) |
| 468 |
{ |
| 469 |
|
| 470 |
value -= 0x0100; |
| 471 |
bytes[posn++] = (byte)(value / 0x5E + 0xA1); |
| 472 |
bytes[posn++] = (byte)(value % 0x5E + 0xA1); |
| 473 |
|
| 474 |
continue; |
| 475 |
} |
| 476 |
else |
| 477 |
{ |
| 478 |
|
| 479 |
bytes[posn++] = 0x8E; |
| 480 |
bytes[posn++] = (byte)(value - 0x8E00); |
| 481 |
} |
| 482 |
} |
| 483 |
|
| 484 |
|
| 485 |
return posn - byteIndex; |
| 486 |
} |
| 487 |
#endif |
| 488 |
} |
| 489 |
|
| 490 |
internal class CP51932Decoder : DbcsEncoding.DbcsDecoder |
| 491 |
{ |
| 492 |
public CP51932Decoder () |
| 493 |
: base (null) |
| 494 |
{ |
| 495 |
} |
| 496 |
|
| 497 |
int last_count, last_bytes; |
| 498 |
|
| 499 |
|
| 500 |
public override int GetCharCount (byte [] bytes, int index, int count) |
| 501 |
{ |
| 502 |
return GetCharCount (bytes, index, count, false); |
| 503 |
} |
| 504 |
|
| 505 |
public override |
| 506 |
int GetCharCount (byte [] bytes, int index, int count, bool refresh) |
| 507 |
{ |
| 508 |
CheckRange (bytes, index, count); |
| 509 |
|
| 510 |
|
| 511 |
int value = 0; |
| 512 |
byte[] table0208 = JISConvert.Convert.jisx0208ToUnicode; |
| 513 |
byte[] table0212 = JISConvert.Convert.jisx0212ToUnicode; |
| 514 |
int length = 0; |
| 515 |
int byteval = 0; |
| 516 |
int last = last_count; |
| 517 |
|
| 518 |
while (count > 0) { |
| 519 |
byteval = bytes [index++]; |
| 520 |
--count; |
| 521 |
if (last == 0) { |
| 522 |
if (byteval == 0x8F) { |
| 523 |
|
| 524 |
last = byteval; |
| 525 |
} else if (byteval <= 0x7F) { |
| 526 |
|
| 527 |
length++; |
| 528 |
} else if (byteval == 0x8E) { |
| 529 |
|
| 530 |
last = byteval; |
| 531 |
} else if (byteval >= 0xA1 && byteval <= 0xFE) { |
| 532 |
|
| 533 |
last = byteval; |
| 534 |
} else { |
| 535 |
|
| 536 |
length++; |
| 537 |
} |
| 538 |
} |
| 539 |
else if (last == 0x8E) { |
| 540 |
|
| 541 |
if (byteval >= 0xA1 && byteval <= 0xDF) { |
| 542 |
length++; |
| 543 |
} else { |
| 544 |
|
| 545 |
length++; |
| 546 |
} |
| 547 |
last =0; |
| 548 |
} |
| 549 |
else if (last == 0x8F) { |
| 550 |
|
| 551 |
|
| 552 |
last = byteval; |
| 553 |
} |
| 554 |
else |
| 555 |
{ |
| 556 |
|
| 557 |
value = (last - 0xA1) * 0x5E; |
| 558 |
last = 0; |
| 559 |
if (byteval >= 0xA1 && byteval <= 0xFE) |
| 560 |
{ |
| 561 |
value += (byteval - 0xA1); |
| 562 |
} |
| 563 |
else |
| 564 |
{ |
| 565 |
|
| 566 |
last = 0; |
| 567 |
length++; |
| 568 |
continue; |
| 569 |
} |
| 570 |
|
| 571 |
value *= 2; |
| 572 |
value = ((int) (table0208 [value])) |
| 573 |
| (((int) (table0208 [value + 1])) << 8); |
| 574 |
if (value == 0) |
| 575 |
value = ((int) (table0212 [value])) |
| 576 |
| (((int) (table0212 [value + 1])) << 8); |
| 577 |
if (value != 0) |
| 578 |
length++; |
| 579 |
else |
| 580 |
length++; |
| 581 |
} |
| 582 |
} |
| 583 |
|
| 584 |
|
| 585 |
|
| 586 |
if (refresh && last != 0) |
| 587 |
length++; |
| 588 |
else |
| 589 |
last_count = last; |
| 590 |
|
| 591 |
|
| 592 |
return length; |
| 593 |
} |
| 594 |
|
| 595 |
public override int GetChars (byte[] bytes, int byteIndex, |
| 596 |
int byteCount, char[] chars, |
| 597 |
int charIndex) |
| 598 |
{ |
| 599 |
return GetChars (bytes, byteIndex, byteCount, chars, charIndex, false); |
| 600 |
} |
| 601 |
|
| 602 |
public override |
| 603 |
int GetChars (byte[] bytes, int byteIndex, |
| 604 |
int byteCount, char[] chars, |
| 605 |
int charIndex, bool refresh) |
| 606 |
{ |
| 607 |
CheckRange (bytes, byteIndex, byteCount, chars, charIndex); |
| 608 |
|
| 609 |
|
| 610 |
int posn = charIndex; |
| 611 |
int charLength = chars.Length; |
| 612 |
int byteval, value; |
| 613 |
int last = last_bytes; |
| 614 |
byte[] table0208 = JISConvert.Convert.jisx0208ToUnicode; |
| 615 |
byte[] table0212 = JISConvert.Convert.jisx0212ToUnicode; |
| 616 |
|
| 617 |
while (byteCount > 0) { |
| 618 |
byteval = bytes [byteIndex++]; |
| 619 |
--byteCount; |
| 620 |
if (last == 0) { |
| 621 |
if (byteval == 0x8F) { |
| 622 |
|
| 623 |
last = byteval; |
| 624 |
} else if (byteval <= 0x7F) { |
| 625 |
|
| 626 |
if (posn >= charLength) |
| 627 |
throw Insufficient (); |
| 628 |
chars [posn++] = (char) byteval; |
| 629 |
} else if (byteval == 0x8E) { |
| 630 |
|
| 631 |
last = byteval; |
| 632 |
} else if (byteval >= 0xA1 && byteval <= 0xFE) { |
| 633 |
|
| 634 |
last = byteval; |
| 635 |
} else { |
| 636 |
|
| 637 |
if (posn >= charLength) |
| 638 |
throw Insufficient (); |
| 639 |
chars [posn++] = '\u30FB'; |
| 640 |
} |
| 641 |
} |
| 642 |
else if (last == 0x8E) { |
| 643 |
|
| 644 |
if (byteval >= 0xA1 && byteval <= 0xDF) { |
| 645 |
value = ((byteval - 0x40) | |
| 646 |
(last + 0x71) << 8); |
| 647 |
if (posn >= charLength) |
| 648 |
throw Insufficient (); |
| 649 |
chars [posn++] = (char) value; |
| 650 |
} else { |
| 651 |
|
| 652 |
if (posn >= charLength) |
| 653 |
throw Insufficient (); |
| 654 |
chars [posn++] = '\u30FB'; |
| 655 |
} |
| 656 |
last =0; |
| 657 |
} |
| 658 |
else if (last == 0x8F) { |
| 659 |
|
| 660 |
|
| 661 |
last = byteval; |
| 662 |
} |
| 663 |
else |
| 664 |
{ |
| 665 |
|
| 666 |
value = (last - 0xA1) * 0x5E; |
| 667 |
last = 0; |
| 668 |
if (byteval >= 0xA1 && byteval <= 0xFE) |
| 669 |
{ |
| 670 |
value += (byteval - 0xA1); |
| 671 |
} |
| 672 |
else |
| 673 |
{ |
| 674 |
|
| 675 |
last = 0; |
| 676 |
if (posn >= charLength) |
| 677 |
throw Insufficient (); |
| 678 |
chars [posn++] = '\u30FB'; |
| 679 |
continue; |
| 680 |
} |
| 681 |
|
| 682 |
value *= 2; |
| 683 |
value = ((int) (table0208 [value])) |
| 684 |
| (((int) (table0208 [value + 1])) << 8); |
| 685 |
if (value == 0) |
| 686 |
value = ((int) (table0212 [value])) |
| 687 |
| (((int) (table0212 [value + 1])) << 8); |
| 688 |
if (posn >= charLength) |
| 689 |
throw Insufficient (); |
| 690 |
if (value != 0) |
| 691 |
chars [posn++] = (char)value; |
| 692 |
else |
| 693 |
chars [posn++] = '\u30FB'; |
| 694 |
} |
| 695 |
} |
| 696 |
|
| 697 |
if (refresh && last != 0) { |
| 698 |
|
| 699 |
|
| 700 |
if (posn >= charLength) |
| 701 |
throw Insufficient (); |
| 702 |
chars [posn++] = '\u30FB'; |
| 703 |
} |
| 704 |
else |
| 705 |
last_bytes = last; |
| 706 |
|
| 707 |
|
| 708 |
return posn - charIndex; |
| 709 |
} |
| 710 |
|
| 711 |
Exception Insufficient () |
| 712 |
{ |
| 713 |
throw new ArgumentException |
| 714 |
(Strings.GetString |
| 715 |
("Arg_InsufficientSpace"), "chars"); |
| 716 |
} |
| 717 |
}; |
| 718 |
|
| 719 |
[Serializable] |
| 720 |
public class ENCeuc_jp : CP51932 |
| 721 |
{ |
| 722 |
public ENCeuc_jp () : base() {} |
| 723 |
|
| 724 |
}; |
| 725 |
|
| 726 |
}; |