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);
}
});
}