mirror of
https://github.com/zxing/zxing.git
synced 2024-11-10 04:54:04 -08:00
Closes issue #806: bad encodation switch in non-ASCII DataMatrix encodation (credit micjahn)
This commit is contained in:
parent
11f5278aa7
commit
458923c3cd
|
@ -35,7 +35,8 @@ final class Base256Encoder implements Encoder {
|
||||||
|
|
||||||
int newMode = HighLevelEncoder.lookAheadTest(context.getMessage(), context.pos, getEncodingMode());
|
int newMode = HighLevelEncoder.lookAheadTest(context.getMessage(), context.pos, getEncodingMode());
|
||||||
if (newMode != getEncodingMode()) {
|
if (newMode != getEncodingMode()) {
|
||||||
context.signalEncoderChange(newMode);
|
// Return to ASCII encodation, which will actually handle latch to new mode
|
||||||
|
context.signalEncoderChange(HighLevelEncoder.ASCII_ENCODATION);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,7 +59,8 @@ class C40Encoder implements Encoder {
|
||||||
if ((count % 3) == 0) {
|
if ((count % 3) == 0) {
|
||||||
int newMode = HighLevelEncoder.lookAheadTest(context.getMessage(), context.pos, getEncodingMode());
|
int newMode = HighLevelEncoder.lookAheadTest(context.getMessage(), context.pos, getEncodingMode());
|
||||||
if (newMode != getEncodingMode()) {
|
if (newMode != getEncodingMode()) {
|
||||||
context.signalEncoderChange(newMode);
|
// Return to ASCII encodation, which will actually handle latch to new mode
|
||||||
|
context.signalEncoderChange(HighLevelEncoder.ASCII_ENCODATION);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,6 +39,7 @@ final class EdifactEncoder implements Encoder {
|
||||||
|
|
||||||
int newMode = HighLevelEncoder.lookAheadTest(context.getMessage(), context.pos, getEncodingMode());
|
int newMode = HighLevelEncoder.lookAheadTest(context.getMessage(), context.pos, getEncodingMode());
|
||||||
if (newMode != getEncodingMode()) {
|
if (newMode != getEncodingMode()) {
|
||||||
|
// Return to ASCII encodation, which will actually handle latch to new mode
|
||||||
context.signalEncoderChange(HighLevelEncoder.ASCII_ENCODATION);
|
context.signalEncoderChange(HighLevelEncoder.ASCII_ENCODATION);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,8 @@ final class X12Encoder extends C40Encoder {
|
||||||
|
|
||||||
int newMode = HighLevelEncoder.lookAheadTest(context.getMessage(), context.pos, getEncodingMode());
|
int newMode = HighLevelEncoder.lookAheadTest(context.getMessage(), context.pos, getEncodingMode());
|
||||||
if (newMode != getEncodingMode()) {
|
if (newMode != getEncodingMode()) {
|
||||||
context.signalEncoderChange(newMode);
|
// Return to ASCII encodation, which will actually handle latch to new mode
|
||||||
|
context.signalEncoderChange(HighLevelEncoder.ASCII_ENCODATION);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -349,6 +349,13 @@ public final class HighLevelEncodeTestCase extends Assert {
|
||||||
assertEquals("236 185 185 29 196 196 129 56", visualized);
|
assertEquals("236 185 185 29 196 196 129 56", visualized);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testEncodingWithStartAsX12AndLatchToEDIFACTInTheMiddle() {
|
||||||
|
|
||||||
|
String visualized = encodeHighLevel("*MEMANT-1F-MESTECH");
|
||||||
|
assertEquals("238 10 99 164 204 254 240 82 220 70 180 209 83 80 80 200", visualized);
|
||||||
|
}
|
||||||
|
|
||||||
@Ignore
|
@Ignore
|
||||||
@Test
|
@Test
|
||||||
public void testDataURL() {
|
public void testDataURL() {
|
||||||
|
|
Loading…
Reference in a new issue