Skip to content

Commit 8d754e2

Browse files
committed
fix #92 Datamatrix GS1 <GS> separator
1 parent c2d8a65 commit 8d754e2

3 files changed

Lines changed: 23 additions & 7 deletions

File tree

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.4.26
1+
2.4.27

src/Type/Square/Datamatrix.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ protected function getHighLevelEncoding(string $data): array
253253
$cco == 232 // FNC1 (ASCII 232 - HEX \xE8)
254254
|| $cco == 29 // <GS> (ASCII 29 - HEX \x1D)
255255
) {
256-
$cdw[] = $cco; // don't encode, just pass it through.
256+
$cdw[] = 232; // FNC1
257257
++$pos;
258258
++$cdw_num;
259259
continue;

test/Square/DatamatrixTest.php

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -422,17 +422,33 @@ public static function getGridDataProvider(): array
422422
'8b4f688a774130bc654e39dfcfadb482'
423423
],
424424
[
425-
'DATAMATRIX,S,GS1,C40',
425+
'DATAMATRIX,S,GS1',
426426
// \xE8 is the control character FNC1 (ASCII 232)
427-
"\xE8" . '01095011010209171719050810ABCD1234' . "\xE8" . '2110',
428-
'ba117111dfa40a40e1bb968c719d2eef'
427+
// Expected read:
428+
// (01)03453120000011
429+
// (17)191125
430+
// (10)ABCD1234
431+
// (21)10
432+
"\xE8" . '01034531200000111719112510ABCD1234' . "\xE8" . '2110',
433+
'3c66c6c7355e7dea071501216e894eac'
429434
],
430435
[
431436
'DATAMATRIX,S,GS1',
432437
// \xE8 is the control character FNC1 (ASCII 232)
433438
// \x1D is the control character <GS> (ASCII 29)
434-
"\xE8" . '01095011010209171719050810ABCD1234' . "\x1D" . '2110',
435-
'cc096c94e0e2d88e8c50e3fdccef60ce'
439+
// Expected read:
440+
// (01)03453120000011
441+
// (17)191125
442+
// (10)ABCD1234
443+
// (21)10
444+
"\xE8" . '01034531200000111719112510ABCD1234' . "\x1D" . '2110',
445+
'3c66c6c7355e7dea071501216e894eac'
446+
],
447+
[
448+
'DATAMATRIX,S,GS1,C40',
449+
// \xE8 is the control character FNC1 (ASCII 232)
450+
"\xE8" . '01095011010209171719050810ABCD1234' . "\xE8" . '2110',
451+
'ba117111dfa40a40e1bb968c719d2eef'
436452
]
437453
];
438454
}

0 commit comments

Comments
 (0)