ZXing.Net icon indicating copy to clipboard operation
ZXing.Net copied to clipboard

Binary data support

Open sergeykorobeynikov opened this issue 4 years ago • 2 comments

I can not find the possibility of encoding binary data (byte[] instead string). Encoding data into a string is not a solution, if only because of the use of control characters.

var writer = new DataMatrixWriter();
//writer.encode()
public BitMatrix encode(string contents, BarcodeFormat format, int width, int height, IDictionary<EncodeHintType, object> hints);
public BitMatrix encode(string contents, BarcodeFormat format, int width, int height);

Why only string supported?

sergeykorobeynikov avatar May 31 '20 03:05 sergeykorobeynikov

I think that is a historical reason. This port is based on the original java version. I have no idea why there was that decision. Perhaps because the first implemented codes don't support binary data (like EAN, UPC, etc.). I think in the past I used ISO8859-1 or ISO8859-15 for string encoding of binary data. As far as I remember it worked for every byte from 0 to 255.

micjahn avatar Jun 02 '20 20:06 micjahn

This does not allow the use of the library in industrial solutions.

sergeykorobeynikov avatar Jun 03 '20 07:06 sergeykorobeynikov