Skip to content

Commit

Permalink
Micro QR Code: allow empty content, if user requests it
Browse files Browse the repository at this point in the history
  • Loading branch information
gredler committed Oct 4, 2024
1 parent b334f2f commit c7acc71
Show file tree
Hide file tree
Showing 10 changed files with 82 additions and 53 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,8 @@ and data.
#### Okapi Barcode 0.4.8
- MaxiCode: improve handling of partial and malformed postal codes (modes 2 and 3)
- Code 11: allow empty content, if user requests it
- Micro QR Code: allow empty content, if user requests it
- Micro QR Code: fix last data character ignored during encoding in some scenarios

#### Okapi Barcode 0.4.7
- Update build toolchain from Java 17 to Java 21 (minimum target runtime remains Java 8)
Expand Down
9 changes: 5 additions & 4 deletions src/main/java/uk/org/okapibarcode/backend/MicroQrCode.java
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ private void inputCharCheck() {

/* Check that input includes valid characters */

if (content.matches("[\u0000-\u00FF]+")) {
if (content.matches("[\u0000-\u00FF]*")) {
/* All characters in ISO 8859-1 */
return;
}
Expand Down Expand Up @@ -707,12 +707,13 @@ private void generateBinary(int version) {

info("Encoding: ");

do {
while (position < content.length()) {

data_block = inputMode[position];
blockLength = 0;
do {
blockLength++;
} while (((blockLength + position) < content.length())
} while (((position + blockLength) < content.length())
&& (inputMode[position + blockLength] == data_block));

switch (data_block) {
Expand Down Expand Up @@ -886,7 +887,7 @@ private void generateBinary(int version) {
}

position += blockLength;
} while (position < content.length() - 1);
}

/* Add terminator */
switch(version) {
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
PROPERTIES

emptyContentAllowed=true
content=

LOG

Encoding:
Codewords: 0 236 0
Version: M1
Mask Pattern: 1
Blocks Merged: 32 -> 19

CODEWORDS

71111
1514
1131113
1131122
1131122
1511111
7112
083
2513
01111313
13115
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,27 @@ content=\x20V.WTTVΔ\n

LOG

Encoding: ALPH (7) 1651 1922 1334 31 KANJ (1) 482
Codewords: 95 57 248 42 108 254 67 196 0 236 0
Encoding: ALPH (7) 1651 1922 1334 31 KANJ (1) 482 BYTE (1) 10
Codewords: 95 57 248 42 108 254 67 197 8 80 0
Version: M3
ECC Level: L
Mask Pattern: 10
Blocks Merged: 56 -> 45
Mask Pattern: 0
Blocks Merged: 58 -> 44

CODEWORDS

711111111
151611
1131113211
11311111311
11311323
1511142
7422
0;121
63312
01452111
211421121
032221113
9132
031125111
32111313
1515111
113112312
11311413
1131114111
1511214
711132
081231
41221311
0121164
5111412
071111112
121632
0211122411
2321151
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,27 @@ content=duV.WTTTt

LOG

Encoding: BYTE (2) 100 117 ALPH (6) 1437 1469 1334
Codewords: 137 145 213 107 59 111 105 176 0 236 0
Encoding: BYTE (2) 100 117 ALPH (6) 1437 1469 1334 BYTE (1) 116
Codewords: 137 145 213 107 59 111 105 180 46 128 0
Version: M3
ECC Level: L
Mask Pattern: 10
Blocks Merged: 58 -> 46
Mask Pattern: 1
Blocks Merged: 65 -> 48

CODEWORDS

711111111
151611
11311143
11311111113
113113122
1511121111
78
0;211
632211
015121212
311145
0411221121
1411113111
022122222
2211414
15111411
1131113121
1131114111
11311112121
15171
72123
082311
4221222
0361221
11211141111
0212132211
111121111311
01311111222
1131441
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ content=5\x0E8dΔ\n

LOG

Encoding: BYTE (4) 53 14 56 100 KANJ (1) 482
Codewords: 68 53 14 56 100 98 30 32 0 236 17 236 17 236
Encoding: BYTE (4) 53 14 56 100 KANJ (1) 482 BYTE (1) 10
Codewords: 68 53 14 56 100 98 30 36 16 160 0 236 17 236
Version: M4
ECC Level: M
Mask Pattern: 0
Blocks Merged: 70 -> 59
Blocks Merged: 77 -> 64

CODEWORDS

Expand All @@ -20,15 +20,15 @@ CODEWORDS
113113121111
113115212
11311111124
151231121
151222121
721133
0935
0926
11121111512
0:1411
1166111
0512135
49112
011528
121115321
0131211116
11211113411
0121142411
123521111
0531125
124321112
0111111;
121221521
01111131111113
221321411

0 comments on commit c7acc71

Please sign in to comment.