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

zxing command line utility should not add newline to output on stdout #91

Open
jose1711 opened this issue Jan 2, 2020 · 0 comments
Open

Comments

@jose1711
Copy link

jose1711 commented Jan 2, 2020

Consider the following example:

  • prepare input data

    $ dd if=/dev/urandom bs=1 count=1000 of=random_data
    1000+0 records in
    1000+0 records out
    1000 bytes (1.0 kB) copied, 0.00658353 s, 152 kB/s
    
    $ md5sum random_data
    13952535b138a595209fc2296330c3de  random_data
    
  • generate qr code using qrencode

    $ qrencode -8 -r random_data -o random_data_qr.png
    
  • read data back using zxing and compare against the original

    $ zxing random_data_qr.png > random_data_decoded
    
    $ zxing random_data_qr.png | md5sum -
    643d5e12ba211ceb3edc3ae8a0492a9c  -
    
    $ ls -l random_data random_data_decoded
    -rw-r--r-- 1 jose jose 1000 Jan  2 09:11 random_data
    -rw-r--r-- 1 jose jose 1001 Jan  2 09:13 random_data_decoded
    

    realize that input and output is not equal.

  • strip the last character (newline) from the output

    $ truncate --size=-1 random_data_decoded
    $ md5sum random_data_decoded
    13952535b138a595209fc2296330c3de  random_data_decoded
    

    now the sum matches.

My expectation is that zxing does not add the newline character arbitrarily or at least has an option to disable such behavior.

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

1 participant