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); } }); } 
2
  • I'd guess that the encoding/decoding is not being performed using the same QR code standard. Commented Oct 1, 2020 at 9:49
  • UTF-8 is not the default character set in QR Codes See this answer: stackoverflow.com/questions/51516612/… Commented Oct 1, 2020 at 9:59

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.