简体   繁体   English

在ZXing.Net中将数字字符串编码为字母数字

[英]Encode numeric string as alphanumeric in ZXing.Net

I'm building an app that requires encoding of a 16-digit all-numerical string, using ZXing.Net, if I do the following: 如果执行以下操作,则我正在使用ZXing.Net构建需要对16位全数字字符串进行编码的应用程序:

ZXing.Common.EncodingOptions qr_options = new ZXing.Common.EncodingOptions();
qr_options.Width = 144;
qr_options.Height = 144;
qr_options.Hints.Add(ZXing.EncodeHintType.DISABLE_ECI, true);
IBarcodeWriter qr_wr = new BarcodeWriter() { Format = BarcodeFormat.QR_CODE, Options = qr_options};

OutputImg = (WriteableBitmap)qr_wr.Write(MyAllNumberString).ToBitmap();

I'm getting a QR code that's encoded as numerics, which generates a different raw byte array. 我得到一个编码为数字的QR码,它会生成一个不同的原始字节数组。 Is there a setting somewhere that I need to set, so that the numeric string is encoded as alphanumeric string? 是否需要在某处进行设置,以便将数字字符串编码为字母数字字符串?

I ended up building ZXing.net from source, and modified the source code. 我结束了从源代码构建ZXing.net和修改源代码。 There is a function inside ZXing.net that checks your input string to be encoded, if that string contains only numeric characters, it will set the encoding mode of QR code to NUMERICAL. ZXing.net中有一个功能可以检查您要编码的输入字符串,如果该字符串仅包含数字字符,它将把QR码的编码模式设置为NUMERICAL。 I added an option to force it to be encoded as ALPHANUMERICAL. 我添加了一个选项,以强制将其编码为ALPHANUMERICAL。 I'll post a link to changes I made later. 我将发布一个链接,指向以后进行的更改。 I have raised this issue to ZXing.Net's owner but they seem lukewarm to the solution I proposed. 我已经向ZXing.Net的所有者提出了此问题,但他们似乎对我提出的解决方案不满意。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM