Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code with Chinese can't be parsed #214

Open
VincentTV opened this issue Sep 23, 2021 · 3 comments
Open

Code with Chinese can't be parsed #214

VincentTV opened this issue Sep 23, 2021 · 3 comments

Comments

@VincentTV
Copy link

These two QR codes are generated using the same way, and the one on the left that contains Chinese cannot be parsed.

qrcode

Return Data:
Res

@dlwe
Copy link

dlwe commented Dec 27, 2021

Another example.
https://upload.wikimedia.org/wikipedia/commons/3/32/Japan-qr-code-billboard.jpg in https://en.wikipedia.org/wiki/QR_code
Japan-qr-code-billboard

The content of this QR code is "http://sagasou.mobi

MEBKM:TITLE:探そうモビで専門学校探し!;URL:http://sagasou.mobi;;".
jsQR returns code, but code.data is an empty string.

@Arno500
Copy link

Arno500 commented Aug 17, 2022

Due to how "data" is handled in this lib, you may not use it if the code doesn't contain ASCII data (which it does not, here). You also happen to use an old text encoding (notably GBK) and in JS this is not exactly trivial to handle traditionally.
You may instead use "binaryData" and a TextDecoder in this way:

new TextDecoder("gbk").decode(Uint8Array.from(result.binaryData))

And that'll give you the string you were trying to get.

@fengdh
Copy link

fengdh commented Aug 24, 2022

You must use correct encoding to parse raw result.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants