mebjas / html5-qrcode

A cross platform HTML5 QR code reader. See end to end implementation at: https://scanapp.org
https://qrcode.minhazav.dev
Apache License 2.0
5.05k stars 975 forks source link

Unable to scan CODE_39 Barcode correctly #675

Open nasqasim opened 1 year ago

nasqasim commented 1 year ago

Describe the bug Trying to scan a CODE_39 type barcode and getting different results

To Reproduce Steps to reproduce the behavior:

  1. Scan the barcode shared as screenshot
  2. Try multiple Times , the answer should be 0825964 , but getting different results when scanning each time
  3. I have also shared response list from demo URL

Expected behavior Getting different results when scanning each time

Screenshots WhatsApp Image 2023-01-19 at 4 57 41 PM

WhatsApp Image 2023-01-19 at 5 00 27 PM

Caitlin-Finn commented 1 year ago

I am also experiencing this issue with UPC-A, UPC-E, EAN-13, EAN-8 and ITF. It is consistently scanning, but produces random numbers approximately 2 out of 5 times. This is happening on all device types. Chrome browser, Android Pixel 4a, iPhone XR, iPhone SE etc.

mebjas commented 1 year ago

Ah, I am able to reproduce this. This should be due to error in underlying system.

Let me see what can be done on my end to address this.

Caitlin-Finn commented 1 year ago

@mebjas great, thank you! Let me know if there is anything I can help with.

Smig0l commented 11 months ago

any updates?

seems that if i upload the barcode image it will decode it correctly... i tried with zxing-js-scanner and it works:

<script src="{{ asset('js/zxing-library-0.20.0.min.js') }}"></script> 
    <script type="text/javascript">
       $(document).ready(function() {
            //https://github.com/zxing-js/library srcjs: https://unpkg.com/@zxing/library@latest/umd/index.min.js
            const constraints = {
                audio: false,
                video: {
                    facingMode: { exact: "environment" },
                    width: { ideal: 200 },
                    height: { ideal: 300 }
                }
            };
            const codeReader = new ZXing.BrowserMultiFormatReader();
            codeReader.decodeOnceFromConstraints(constraints, 'video')
            .then(result => {
                $('#codice_articolo').val("");
                $('#codice_articolo').val(result.text);
                $('#video').hide();
                $('#quantita_rilevata').focus();
                codeReader.reset();
            })
            .catch(err => {
                // Display a Bootstrap alert with the error message
                const alertContainer = $('#alert-container');
                const errorMessage = err.message && 'Errore! prova a ricaricare la pagina e consenti a questo sito di accedere alla fotocamera.';
                const alertHtml = `
                    <div class="alert alert-danger alert-dismissible fade show" role="alert">
                        ${errorMessage}
                    </div>
                `;
                alertContainer.html(alertHtml);
            });
        });
    </script>

EDIT: maybe we need to update this library with the latest zxing js?

ollejernstrom commented 8 months ago

Any update on this? struggling with the same issue.