NUL Rendering

Nov 2, 2012 at 1:36 PM

First of all, THANK YOU for this great work.

I have a project that requires rendering of NUL and other non-printing characters in the QR code.

The decoder to read this has the ability in capturing what is after NUL etc. So, to ordinary decoder, "Part A \0 Part B" decodes to "Part A" but for this decoder, it reads both.

Can it be implemented in QrCode.Net?

If I input "\0" in the string to encode, it simply renders image that decodes to "\0". It seems string in .NET simply ignore this. Also tried "\0000" and it returns "\0" when decoded.

I was wondering if the "Encode" can also accept byte array as input.

Again, thank you.

Coordinator
Nov 4, 2012 at 5:38 AM

Do you have full control of decoder? I think first question is rather pointless if we can solve byte array right?

 

For full control I mean you can access process within decode. There are few steps before you will get final result. 

Scan => Grab bit matrix => remove mask => get body bits array => detect which mode it use and which char encode table it uses. => decode bits array to char. 

If you have full control, last process you can terminate. Stop decoder at detect mode and char table step and grab your byte array. If you can not do that, it will be rather hard. QrCode it self (ISO specification) doesn't support byte array. They are base on char table. If you don't have full control of decoder, then it will be easier if you can find char table that doesn't have those null char. 

Full 8-bit-byte char table I have list under here. http://qrcodenet.codeplex.com/SourceControl/changeset/view/19827#236629

Gma.QrCodeNet.Encoder.Dataencodation.ECIset.cs

 

If you have full control, then we can expand ECI set. For example ECI value equal to 30 is for byte array. Then encode from there. If your decode find out its eight bit byte encode and ECI value is 30, then do not decode. Just extract full bit array to byte array. 

 

If you don't have full control, then you have to find proper char table that doesn't have special char, use those char and put into encoder. Once fully decode, read string and translate back to byte array. 

 

First option gives best performance but will need a lot of control on both encoder and decoder. Second option is easier. 

Nov 5, 2012 at 9:20 AM
Edited Nov 6, 2012 at 5:00 AM

Thank you for the through response, as always.

Strange enough though, the client accepted the output images I generated by:

1. Part A string encoded to byte array + "\0" or "\n" encoded to byte array + Part B string encoded to byte array. Just System.Buffer.BlockCopy, nothing fancy.

2. Convert back the resulting array above to a string

3. Encode the above string to QR code.

In short, what I learnt are:

1. The QR code generation, by and large, is not meant for byte array as input parameter.

2. No one should expect control of decoder.

Learnt a lot, thanks.

Cliff