nimiq / qr-scanner

Lightweight Javascript QR Code Scanner
https://nimiq.github.io/qr-scanner/demo
MIT License
2.35k stars 509 forks source link

UTF-8 encoded text can not be read #232

Open MalteJoe opened 1 year ago

MalteJoe commented 1 year ago

Hi, I'm having the same issue as #8 with QR Codes including UTF-8 encoded Characters.

I have two similar QR Codes with a JSON Payload looking like this:

{
  "signature": "QZwMUaO6yhZAuG3Jw/HKEoTbORQdRVj+2NcamlBLQVZoLmV/fRBrLcMtqIQAOLiR4gVPEERrDYRW0wvufPLwwaTZs4YtbDeoq3GjItmkmNgorOSIU/NYKVfHMze6nANR0O/a/Q6+7seGSs8stKc4/UsBONetlNcekvwMvHTGFH01sxyhxAWeBg4jXBay4SgQENwF6xxVa5S2GBRh2y0Iz1PYEmShFT1fmZlzAWp5DAiWjV2S7cJb+oS7j4lJUyhh7bUGSh7CGB5dlbhVOftBaxWsSxsI5jAIZ38cHy1wJdIYu+kTITpd+oHkQ2BVDF4taJeRCDQnaBIIIxvQBmMkjw==",
  "payload": "{\"person\":{\"id\":\"6f33b4fb-115c-48db-8fae-1f3e6ce8d8b7\",\"firstName\":\"Some\",\"surname\":\"One\",\"personKey\":\"P1053\"},\"edition\":\"3b5b10d6-e384-4401-8594-125f2804e46e\"}"
}

In one case the surname contains a german umlaut (field surname changed to Öne) which cannot be read by this library.

These are the two QR-Codes I'm trying to read:

Some One some-one

Some Öne some-öne

The first one is read correctly by QRScanner, however the second one with the umlaut Ö in it is not. It just returns data: '' and the options.onDecodeError function isn't called either. I can read both the QR Codes with other QR-Code scanning apps correctly.

Versions Google Chrome (Linux): 112.0.5615.165 Google Chrome (Android): 112.0.5615.136 qr-scanner: 1.4.2

RobsyRocket commented 6 months ago

Hi @MalteJoe . I'm also not able to scan your broken QR code on my machine, which is a Apple M1 Pro with macOS 13.6.1 (22G313) and browser Brave [Version 1.60.118 Chromium: 119.0.6045.163 (Offizieller Build) (arm64)].

Could you provide some details about how you created your QR codes? I get perfectly fine results when I take your data, change One to Öne, put it into https://goqr.me/de/, and generate a new QR code. No settings except the size got changed (error correction level L, size 600px).

qrcode with special character - working

Joemarie123 commented 4 months ago

@RobsyRocket Try this Data "Jhon Mañana Doe"

jogz44 commented 3 months ago

Hi @RobsyRocket ,

I use VB,NET to generate a QR code, and I also use names with UTF-8 characters like ñ. Like @MalteJoe the scanner returns blank value.

this is the sample code

Dim genQR As New MessagingToolkit.Barcode.BarcodeEncoder Dim g As Graphics

PictureBox1.Image = New Bitmap(genQR.Encode(MessagingToolkit.Barcode.BarcodeFormat.QRCode, "Jhon Moñe Doe"))

g = Graphics.FromImage(PictureBox1.Image) g.DrawImage(bmp, New Point((PictureBox1.Image.Width - bmp.Width) / 2, (PictureBox1.Image.Height - bmp.Height) / 2))

and heres the QR code image

Joemarie123 commented 3 months ago

Dear Ma'am/Sir,

I hope you're doing well. I'm a programmer using your Qr-Scanner Libraries and I've encountered a minor issue. It doesn't detect the 'Ñ' character. This could affect my work significantly.

Could you please investigate and fix this? I believe addressing this would improve the Qr-Scanner usability and reliability.

Looking forward to your prompt response.

Best regards, Joemarie O. Rendon