EAN 13 with leading 0 is being interpreted with UPCA

My app can scan both EAN-13 and UPC-A barcodes. When I have a valid EAN13 barcode with a leading 0, the 0 is being removed by dependence , and it becomes a valid UPC-A code.

Attached is an example of barcodes that are valid for this scenario. enter image description here

My application is developed with Ionic and Capacitor, using the Capacitor Barcode Scanner community plugin for reading barcodes (https://github.com/ionic-team/capacitor-barcode-scanner). One possible solution would be to create a function that adds the digit "0" to the beginning and checks if the result is a valid EAN-13. However, in cases where UPC-A is also valid for the EAN-13 format, always adding this zero can lead to inconsistencies. How can I resolve this issue more effectively?

Upvotes: 3

Views: 299

Answers (0)

Related Questions