Skip to content

feat(barcodes): Code 39 (#154) and UPC-E (#155) - #158

Merged
Tim81 merged 1 commit into
mainfrom
barcodes-code39-upce
Jul 6, 2026
Merged

feat(barcodes): Code 39 (#154) and UPC-E (#155)#158
Tim81 merged 1 commit into
mainfrom
barcodes-code39-upce

Conversation

@Tim81

@Tim81 Tim81 commented Jul 6, 2026

Copy link
Copy Markdown
Owner

Second PR in the v1.10 barcode expansion, stacked on #157 (merge #157 first — GitHub retargets this to main automatically once #157 lands).

Symbologies

New public surface (in PublicAPI.Unshipped.txt): Code39Barcode (+ Content / CheckDigit / FullAscii / WideNarrowRatio) and EanSymbology.UpcE.

Review + testing

This branch went through an adversarial review that caught a UPC-E expansion defect (the last-digit-5–9 case produced a 12-digit UPC-A and a wrong check digit, rendering ~half of UPC-E inputs unscannable). It is fixed, guarded by a length invariant, and covered by a decode-oracle test that renders a 5–9 UPC-E and decodes it with zxing-cpp (decoded 0012345000058, matching).

Verified locally: dotnet build -c Release (0 warnings), 649 tests pass (the decode oracle ran for real — pdftoppm + zxing-cpp installed), dotnet format --verify-no-changes clean, clean-room check pass. Decode round-trips verified against zxing-cpp for Code 39 and UPC-E.

Known minor deferral: empty Code 39 content encodes to a bare start/stop symbol rather than being rejected — low severity, noted for a follow-up.

Add Code 39 (ISO/IEC 16388 / AIM USS-39) as a Barcode1D with an optional
modulo-43 check character, Full ASCII (Extended Code 39) mode, and a
configurable wide/narrow ratio; and UPC-E (zero-suppressed UPC-A) as a new
EanSymbology value.

- Code39Barcode + Code39/ (encoder, plus the 43-character and Full-ASCII
  tables transcribed from AIM USS-39 Table 2 and verified character by
  character).
- EanSymbology.UpcE with UPC-A<->UPC-E compression and expansion, the
  number-system parity tables, and a length invariant on the expansion.
- DefaultAltText arms, docs/barcodes-guide.md sections, and encoder / table /
  property / decode-oracle tests. PublicAPI.Unshipped updated.

Decode round-trips verified against zxing-cpp for Code 39 and UPC-E, including
UPC-E symbols whose sixth digit is 5-9.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant