FCN1 char is defined the same in all three encodings. The current implementation switched encodings multiple times, even if the whole code could be created with encoding C. According to GS1 spec the whole barcode (including Quiet Zones) should not be longer than 165 mm (6.5"), thus any additional symbol added to the code resulted in longer code. This PR optimizes the proces of code creation, avoiding encoding switch.
1) For code128, starding encoding set to C
2) Added function that determines whether the char is FNC1 char - defined the same in all three encodings
3) _maybe_switch_charset recognizes that FNC1 char is defined in all three encodings, and avoids changing encodings
4) added testcases for new functionality.
FCN1 char is defined the same in all three encodings. The current implementation switched encodings multiple times, even if the whole code could be created with encoding C. According to GS1 spec the whole barcode (including Quiet Zones) should not be longer than 165 mm (6.5"), thus any additional symbol added to the code resulted in longer code. This PR optimizes the proces of code creation, avoiding encoding switch.
1) For code128, starding encoding set to C 2) Added function that determines whether the char is FNC1 char - defined the same in all three encodings 3) _maybe_switch_charset recognizes that FNC1 char is defined in all three encodings, and avoids changing encodings 4) added testcases for new functionality.