libqrencode icon indicating copy to clipboard operation
libqrencode copied to clipboard

Fix output of FNC1 in first position needed for GS1

Open warped-rudi opened this issue 6 years ago • 5 comments

It appears that this functionality was not fully implemented. Thus, code generation always failed when trying to use QRinput_setFNC1First().

Signed-off-by: Rüdiger Ihle [email protected]

warped-rudi avatar Jul 30 '19 15:07 warped-rudi

I'm new to this lib, and I'm still trying to familiarize myself with it. Could you share any sample code of how to encode the FNC1 character?

burlrice avatar Nov 04 '21 17:11 burlrice

The basic sequence to create GS1 codes should be something like this:

QRinput *input;
QRcode  *qrcode;

input = QRinput_new2( version, QR_ECLEVEL_M );

QRinput_setFNC1First( input );
Split_splitStringToQRinput( codeString, input, QR_MODE_8, true );
qrcode = QRcode_encodeInput( input );

QRinput_free( input );

FNC1 symbols on other positions than the first are represented as '0x1d' inside of 'codeString' (when using QR_MODE_8) or '%' (when using QR_MODE_AN).

warped-rudi avatar Nov 05 '21 12:11 warped-rudi

Thank you. You just saved me a lot of time.

Is there any chance your branch will get merged into the master repo?

burlrice avatar Nov 05 '21 14:11 burlrice

I have no idea. I sent this pull request two years ago and it never got any attention.

warped-rudi avatar Nov 06 '21 07:11 warped-rudi

Hi @warped-rudi, @burlrice,

Thank you all for the discussion and the great contribution. I'll review and apply the request as soon as possible.

fukuchi avatar Nov 07 '21 03:11 fukuchi