gcd_fwd-3821c-13749__refs_6193.v1.bzr.patch
src/com/goldencode/p2j/util/I18nOps.java 2022-04-08 16:29:09 +0000 | ||
---|---|---|
546 | 546 |
// interpret key code using source codepage |
547 | 547 |
String chr = get4glCharacter(ascCode, sourceJavaCP); |
548 | 548 |
|
549 |
// 4gl checks for lead byte, however there should be only one character |
|
550 |
if (chr == null || chr.length() > 1) |
|
549 |
// 4gl checks for lead byte, and there should be only one or two characters (two for emoji's) |
|
550 |
// The length 2 in java versus length 1 in 4gl will require FWD to tally a 4gl character count per |
|
551 |
// string, and/or do a deep string parse for double-byte that should count as single byte. |
|
552 |
if (chr == null || chr.length() > 2) |
|
551 | 553 |
{ |
552 | 554 |
return null; |
553 | 555 |
} |
... | ... | |
569 | 571 |
*/ |
570 | 572 |
private static String get4glCharacter(int ascCode, Charset charset) |
571 | 573 |
{ |
572 |
// return unknown value for negative arguments |
|
573 |
if (ascCode < 0) |
|
574 |
{ |
|
575 |
return null; |
|
576 |
} |
|
577 |
|
|
578 | 574 |
// there is no "\0" character in 4GL. Returning empty string. |
579 | 575 |
if (ascCode == 0) |
580 | 576 |
{ |
... | ... | |
582 | 578 |
} |
583 | 579 |
|
584 | 580 |
byte[] data; |
585 |
if (ascCode < 0x0100) |
|
581 |
if (ascCode > 0 && ascCode < 0x0100)
|
|
586 | 582 |
{ |
587 | 583 |
// single byte case |
588 | 584 |
data = new byte[] { (byte) ascCode }; |
589 | 585 |
} |
590 |
else if (ascCode < 0x010000) |
|
586 |
else if (ascCode > 0 && ascCode < 0x010000)
|
|
591 | 587 |
{ |
592 | 588 |
// double byte mode, BigEndian mode |
593 | 589 |
data = new byte[2]; |
594 | 590 |
data[0] = (byte) ((ascCode >>> 8) & 0x0FF); |
595 | 591 |
data[1] = (byte) (ascCode & 0x0FF); |
596 | 592 |
} |
597 |
else if (ascCode < 0x01000000) |
|
593 |
else if (ascCode > 0 && ascCode < 0x01000000)
|
|
598 | 594 |
{ |
599 | 595 |
// triple byte mode, BigEndian mode |
600 | 596 |
data = new byte[3]; |