[reportlab-users] error in code39.py

Randolph Bentson bentson at holmsjoen.com
Thu Jul 9 14:44:31 EDT 2009


I've found that some code39 barcodes don't have the correct check character.
The problem appears to be that the "*" character was being treated just as
the normal chars. I believe the following is a proper fix:
===================================================================
diff -u -r1.1 code39.py
--- code39.py 2009/07/09 18:10:07 1.1
+++ code39.py 2009/07/09 18:24:09
@@ -54,16 +54,16 @@
'W': ("BSBsbsbsb", 32), 'X': ("bSbsBsbsB", 33),
'Y': ("BSbsBsbsb", 34), 'Z': ("bSBsBsbsb", 35),
'-': ("bSbsbsBsB", 36), '.': ("BSbsbsBsb", 37),
- ' ': ("bSBsbsBsb", 38), '*': ("bSbsBsBsb", 39),
- '$': ("bSbSbSbsb", 40), '/': ("bSbSbsbSb", 41),
- '+': ("bSbsbSbSb", 42), '%': ("bsbSbSbSb", 43)
+ ' ': ("bSBsbsBsb", 38), '*': ("bSbsBsBsb", None),
+ '$': ("bSbSbSbsb", 39), '/': ("bSbSbsbSb", 40),
+ '+': ("bSbsbSbSb", 41), '%': ("bsbSbSbSb", 42),
}

_valchars = [
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A',
'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L',
'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
- 'X', 'Y', 'Z', '-', '.', ' ', '*', '$', '/', '+', '%'
+ 'X', 'Y', 'Z', '-', '.', ' ', '$', '/', '+', '%'
]

_extended = {
===================================================================

--
Randolph Bentson
bentson at holmsjoen.com


More information about the reportlab-users mailing list