Skip to content

bug: Japan Post 4-state barcode encoding table may be incorrect #64

@productdevbook

Description

@productdevbook

Summary

The Japan Post 4-state barcode (JP4SCC / Kasutama) encoding table in src/encoders/fourstate.ts may have incorrect bar state mappings. The table uses 3 bars per character, but the official Japan Post Customer Barcode spec uses different encoding.

Details

Current table:

const JP_TABLE: Record<string, FourState[]> = {
  "0": ["F", "F", "T"],
  "1": ["D", "A", "F"],
  // ...
  "-": ["F", "T", "F"],
};

Issues:

  1. Japan Post Customer Barcode uses 3 bars per character (confirmed), but the specific state assignments need verification against the official JP Post specification
  2. The address field encoding only accepts digits and dash (/^[\d-]+$/), but Japan Post barcodes can include alphanumeric characters in the address field for some formats
  3. The check digit calculation sums character values and uses mod 10, which appears correct, but the character-to-value mapping (dash = 10) should be verified
  4. The start/stop bars ["F", "D"] and ["F", "A"] need verification — some references show different start/stop combinations

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingstandardsIndustry standard compliance

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions