Status: New
Owner: ----
Labels: Type-Defect Priority-Medium
New issue 63 by
dlu...@gmail.com: When scanning a barcode,
SCAN_RESULT_BYTES is a king of strange unicode string
http://code.google.com/p/python-for-android/issues/detail?id=63
What steps will reproduce the problem?
1. Create DataMatrix (and probably QR will fail too) barcode with binary
encoding. You may use
http://www.bcgen.com/datamatrix-barcode-creator.html
with "process tilda" option and some binary data.
2. Try to run following script:
import android
droid = android.Android()
code = droid.scanBarcode()
bts = code.result['extras']['SCAN_RESULT_BYTES']
sr = code.result['extras']['SCAN_RESULT']
print type(bts)
print len(bts)
print sr
What is the expected output? What do you see instead?
We surely expect array (list, string, anything other at least Iterable) of
bytes. With the length equal to number of bytes in the barcode. And we
expect scan result to be something like byte string with the same length.
Instead we have everything in unicode strings. SCAN_RESULT is unicode
strings containing comma-separated byte values (great =)) and
SCAN_RESULT_BYTES is unicode string of some strange length (I suppose it
tries to decode it from UTF8 leaving failed bytes in place).
What version of the product are you using? On what operating system?
I use Android 2.3.7 (MiniCM7, Xperia X8) and Python for Android of rev 4
installed with SL4A.
Please provide any additional information below.
I suspect that giving out comma-separated string as SCAN_RESULT can be
ZXing's feature, so I think we can leave it as is, but SCAN_RESULT_BYTES
should definitely not be unicode string.