0

I am trying to read a JSON in a QR code. The problem is that when reading it, it must have some coding problem, and it introduces strange characters instead of special characters like accents, quotes or symbols. The charset in the HTML is already defined as UTF-8.

JSON of the QR code:

{"status":2,"ts":1601999,"t_next_req":"3600","id":"ES0099","fullname":"José Manuel Cabo Martínez"}

JSON I'm reading:

ç000026^¨status¨Ñ¨2¨,¨ts¨Ñ1601999,¨t?next?req¨Ñ¨3600¨,ïd¨ÑËS0099¨,¨fullname¨Ñ¨José Manuel Cabo Martínez¨*

Javascript:

$(document).ready(function() {
var barcode="";
$(document).keypress(function(e) {
    var code = (e.keyCode ? e.keyCode : e.which);
    //Check that the QR code has been read
    if(code==13) {
        wait = true;
        console.log(barcode);
    } else {
        barcode = barcode + String.fromCharCode(e.which);
    }
});
}
  • I'd guess that the encoding/decoding is not being performed using the same QR code standard. – Rory McCrossan Oct 01 '20 at 09:49
  • UTF-8 is not the default character set in QR Codes See this answer: https://stackoverflow.com/questions/51516612/choosing-a-character-encoding-for-qr-codes/61035910#61035910 – Wolfgang Blessen Oct 01 '20 at 09:59

0 Answers0