markusfisch / BinaryEye

Yet another barcode scanner for Android
https://play.google.com/store/apps/details?id=de.markusfisch.android.binaryeye
MIT License
1.53k stars 121 forks source link

barcode generation seems to use UTF-8 instead of ISO-8859-1, causing improper expansion of escape sequences. #509

Open petep0p opened 3 days ago

petep0p commented 3 days ago

I generated the following code in Binary Eye: qr_code__b_3a492

i used escape sequences to input the data, as i wanted a code that contained a specific string of hex values (attempting to program a barcode scanner). However, inputting the escape sequence: \xC6

generates: "C3 86" instead of the expected "C6". This difference corresponds exactly to the differences in the value for the character "Æ" between UTF-8 encoding and ISO-8859-1 encoding. I read somewhere that the QR Code definition specifies that codes should use the ISO-8859-1 encoding, but i don't have the reference off the top of my head. Aside from that, it seems more logical to have an escape sequence be encoded in the most straightforward possible manner.

is this a bug, or am I not correctly understanding how everything is supposed to work?

thanks!! I love this app and use it all the time.

petep0p commented 2 days ago

as added info, the same above code also has the following unintended expansions on other escape sequences: "F2" appears as "C3 B2" (entered as \xF2) "FF" appears as "C3 BF" (entered as \xFF) "FD" appears as "C3 BD" (entered as \xFD) these all follow a parallel type of relationship between UTF-8 and ISO-8859-1 as compared to "C6"

markusfisch commented 1 day ago

Hi, and thanks for filing an issue about that 👍 Yes, this is a bug, indeed! I'm already working on fixing it…

The error already occurs during unscaping here.

petep0p commented 1 day ago

awesome, thank you! you're the best