markusfisch / BinaryEye

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

'Copy to clipboard' and 'Share as TXT' produced unacceptable results #322

Closed meiMingle closed 1 year ago

meiMingle commented 1 year ago

The following code may need to be optimized because it produces results like this

█████████████████████████████ █████████████████████████████ ████ ▄▄▄▄▄ █▀█ █ █ ▄▄▄▄▄ ████ ████ █ █ █▄█▄▄▀█ █ █ ████ ████ █▄▄▄█ █ ▄▄█ █▄▄▄█ ████ ████▄▄▄▄▄▄▄█ █▄█▄█▄▄▄▄▄▄▄████ ████ ▄▀▄██▄▄▀█▄ ▄▀▄▄▄█ ▀████ ████ ▄▀▀█▄ ▀█▄▄▀ ▄█▀█▀ ████ ███████▄▄▄▄█▀▄ ▄█▀ ██▀▀█▄████ ████ ▄▄▄▄▄ █▄█▀▄▄█ ▀██ ▀████ ████ █ █ █▀ ▄█▄ ▀▄▄ ▄▀████ ████ █▄▄▄█ █▀█▀ ▀▄▄▀█▀ ▀ ████ ████▄▄▄▄▄▄▄█▄█▄██▄█▄███▄█████ █████████████████████████████ █████████████████████████████

https://github.com/markusfisch/zxing-cpp/blob/416ffd8fe7473d2620a20ec2a75f5aab901ead7c/wrappers/aar/zxingcpp/src/main/java/de/markusfisch/android/zxingcpp/ZxingCpp.kt#L288

markusfisch commented 1 year ago

Well, this is intentional 😉

See, the text representation looks distorted because of the variable width font.

With a monospace font, it looks like this:

█████████████████████████████
█████████████████████████████
████ ▄▄▄▄▄ █▀█ █ █ ▄▄▄▄▄ ████
████ █   █ █▄█▄▄▀█ █   █ ████
████ █▄▄▄█ █   ▄▄█ █▄▄▄█ ████
████▄▄▄▄▄▄▄█ █▄█▄█▄▄▄▄▄▄▄████
████▄ █ █▀▄ ▀▀▄ ▄▀▄ ▄█▄ █████
████   ▄▀█▄█▄█ ▄▀▀    ▄▀ ████
████▄██▄██▄▄ █ ▄█   ▀█▄█▄████
████ ▄▄▄▄▄ █▄ ▀▄▄█ ▀▄▄█ ▀████
████ █   █ █▀ ▄█▄  ▀█ ▄▄▀████
████ █▄▄▄█ █▀▄█ ▀▄▄▄▄ █▀ ████
████▄▄▄▄▄▄▄█▄████▄█▄▄██▄█████
█████████████████████████████
█████████████████████████████
meiMingle commented 1 year ago

Sorry it was my fault, the problem was with 'Copy to clipboard' not 'Export as TXT'.There is nothing wrong with the code mentioned above, the problem is somewhere else, let me find it

meiMingle commented 1 year ago

I haven't found the problem in the code yet, but by comparing with the results of 'Export as TXT', I found that 'Copy to clipboard' will reduce consecutive multiple spaces to one. Same result for 'Share as TXT'

markusfisch commented 1 year ago

Hm, that's interesting 🤔 Unfortunately, I cannot reproduce this 😬 When I share or copy the text representation into an E-Mail (in my case the GMail app for example), the message still contains all spaces when I receive it. Same when sharing or pasting into the Slack app.

May I ask what Android version you are running?

meiMingle commented 1 year ago

May I ask what Android version you are running?

Android 11

meiMingle commented 1 year ago

Is there any other information needed to move this issue forward?

markusfisch commented 1 year ago

Well, anything that would help me reproduce this issue would be good 😬 I've tested it Android 11 and it works for me there, so this can't be the problem.

Do you have any special clipboard apps installed that might mess with what's on the clipboard?

Do you have access to another device and can you reproduce the issue there?

meiMingle commented 1 year ago

Do you have any special clipboard apps installed that might mess with what's on the clipboard?

Perhaps you're right. But it's a bit hard for me to find it, because I'm not even an Android beginner, and I have too many frameworks/plugins/apps installed on my phone, such as magisk, LSPosed, ADM, Via, ProxyDroid..... .. This weekend, I will try my best to learn the real machine debugging of Android, and try to find the problem.

meiMingle commented 1 year ago

Oh, it was a misunderstanding, now I see that the problem is not with BinaryEye, the problem is with the tool I use to share text from mobile to PC device.

markusfisch commented 1 year ago

No problem, happy you found it 👍