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

Missing characters in generated code #25

Open
juztin opened this issue Oct 30, 2019 · 5 comments
Open

Missing characters in generated code #25

juztin opened this issue Oct 30, 2019 · 5 comments

Comments

@juztin
Copy link

juztin commented Oct 30, 2019

When running:

qrcode "88c77c18" > code.png

The generated code seems to only decode to:

c77c18
@skip2
Copy link
Owner

skip2 commented Oct 30, 2019

I can't reproduce this:

[tfh@localhost ~]$ go/bin/qrcode "88c77c18" > 88c77c18.png
[tfh@localhost ~]$ zbarimg 88c77c18.png 
QR-Code:88c77c18
scanned 1 barcode symbols from 1 images in 0.02 seconds
[tfh@localhost ~]$ 

Here is the image: https://skip.org/drop/88c77c18.png
https://zxing.org/w/decode?u=https%3A%2F%2Fskip.org%2Fdrop%2F88c77c18.png

Can you link to the image you generated? Which software did you use to decode it?

@juztin
Copy link
Author

juztin commented Oct 31, 2019

I did notice that I was behind on commits (was on dc11ecd)
Just to make sure I was running against the binary built from this project, from current `master:

  1. Did a git pull
  2. Removed current binary rm $GOPATH/bin/qrcode
  3. Re-built binary go install ./...
  4. Ran the following:
    $GOPATH/bin/qrcode "88c77c18" > 88c77c18.png
    

The resulting QR-Code decodes to c77c18


If I replace the first the 88 prefix: asdfasdfasdfc77c18, it works
If I prefix it, again, with the eights: 88asdfasdfasdfc77c18, it decodes to: asdfasdfasdfc77c18
If I run directly from the repo: go run qrcode/main.go "88c77c18" > 888c77c18.png it decodes to c77c18

I've tried running in both zsh and bash (just to trying to rule everything out), as well as copying your command above (just replacing the first part with go run qrcode/main.go in the repo directory)

Here's a few other scenarios I've run _(all using go run qrcode/main.go ...:

  • 8888888888 == ""
  • 88888888885555 == ""
  • 8888888888aaaa == "aaaa"
  • 8888888888aaaa8888 == "aaaa"
  • 8888888888aaaa8888a8a8a8a == "aaa"
  • 8888888888aaaa8888a8a8a8o == results in an invalid QR-Code
  • 8aaaa8o == "aaaa8o"
  • 8aaaa8oooooo8o8o8o8o == "aaaa8oooooo8o8o8o8o"
  • 16aaaa == "aaaa"
  • 2aaaa == "aaaa"
  • 3aaaa == "aaaa"
  • a3aaaa == "a3aaaa"
  • ##3aaaa == "##3aaaa"

Update

Just to rule out my machine, I also did the following (same results):

docker run -it --rm --volume "$(pwd)":/output golang
go get -u github.com/skip2/go-qrcode/...
qrcode "3aaaa" > /output/3aaaa.png

@skip2
Copy link
Owner

skip2 commented Oct 31, 2019

Can your decoder software read "88c77c18" from https://skip.org/drop/88c77c18.png ?
Which decoder software are you using?
Can you attach your 3aaaa.png?

@skip2
Copy link
Owner

skip2 commented Oct 31, 2019

QR Codes can contain multiple data types, namely: numeric, alphanumeric, and byte. This minimises the size of each QR code, e.g. as numeric data can be encoded more efficiently than byte data.

If you are having problems decoding numbers, it's possible your decoder software can't decode numeric encoded data correctly.

I have encoded "8888888888aaaa8888" two different ways below. If you can only decode the first type correctly, then your decoder software is broken.

Data segment #0: data type byte: '8888888888aaaa8888'
8888888888aaaa8888_byte_datatype_only

Data segment #0: data type numeric: '8888888888'
Data segment #1: data type byte: 'aaaa'
Data segment #2: data type numeric: '8888'
8888888888aaaa8888_mixed_datatypes

If neither decodes correctly, then you are probably parsing the output of your decoder incorrectly.

@skip2
Copy link
Owner

skip2 commented Nov 5, 2019

Is this still an issue?

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

2 participants