ushelp / EasyQRCodeJS

EasyQRCodeJS is a flexible QR code generator using JavaScript, supporting various drawing methods (Canvas, SVG, Table) and customization options. It's compatible with major frameworks and can be directly downloaded in the browser.
https://www.easyproject.cn/easyqrcodejs/home.html
MIT License
734 stars 156 forks source link

Handling of byte hex string #22

Closed ldlamarc closed 4 years ago

ldlamarc commented 4 years ago

When I give "\x00\x00\x01\x01\x65\xba\xcb\x59" as input I would expect it to generate a QR code which outputs 0000010165bacb59 as Binary(HEX) (on a reader that supports binary qr codes. e.g. QRefine on iOs).

Got: EFBBBF0000010165C2BAC38B59

Changing line 74 to: this.parsedData.push(code) seems to fix it so I assume it is related to the utf-8 transforms.

ushelp commented 4 years ago

@ldlamarc Can your provide some more detail or scene, or an example I can run? I will try to implement it.

ldlamarc commented 4 years ago

See previous comment, not sure if/how I can add more detail. In summary/spec:

Input: "\x00\x00\x01\x01\x65\xba\xcb\x59" Current Output (wrong): EFBBBF0000010165C2BAC38B59

Expected output: 0000010165bacb59

ushelp commented 4 years ago

@ldlamarc Thanks for your feedback.

Because EasyQRCode default is to support text mode, some special characters in binary mode can cause encoding problem. Now I release a new verison 3.8.0, it is support binary(hex) data mode.

ldlamarc commented 4 years ago

With binary mode it works as expected for my use case. Thanks!

ushelp commented 4 years ago

Done.