Port fix for handling start and stop characters
Finish port of r2820 from ZXing
Ported r2821 from ZXing