Re: Datamatrix FNC character

644 views
Skip to first unread message

Sean Owen

unread,
Sep 5, 2012, 9:52:37 AM9/5/12
to zx...@googlegroups.com
The FNC1 character is translated as ASCII 29 (group separator) in the resulting string, because that is how it is translated elsewhere. I am not sure whether you are asking how to read it, how to ignore it, or something else.

marianom

unread,
Sep 5, 2012, 10:02:19 AM9/5/12
to zx...@googlegroups.com
First of all, thanks for the fast answer.
What i need is know where is it, i need to use that character.
So you say if i do result.getContents() and i read each character of that string, i will get the ASCII 29 character in the place where FNC1 it is supposed to be?

Sean Owen

unread,
Sep 5, 2012, 11:58:06 AM9/5/12
to zx...@googlegroups.com
Yes that's right, you should be able to find it by looking for char 29.

marianom

unread,
Sep 5, 2012, 1:31:02 PM9/5/12
to zx...@googlegroups.com
Perfect! When i get home i will try.
Thank you for your support
Message has been deleted

Sean Owen

unread,
Feb 7, 2013, 5:14:56 AM2/7/13
to zx...@googlegroups.com
Not much or any info here, what have you tried, what are you seeing. Remember 29 is not printable.

Alejandro Berzosa Iglesias

unread,
Feb 7, 2013, 5:28:08 AM2/7/13
to zx...@googlegroups.com
I'm trying with this snippet of code:

String code = scanResult.getContents().replace((char) 29, '_');

and then printing it, and I'm not getting any '_'. Also I've made sure that I'm reading EAN-128.

Sean Owen

unread,
Feb 7, 2013, 5:52:03 AM2/7/13
to zx...@googlegroups.com
How about the barcode?

Alejandro Berzosa Iglesias

unread,
Feb 7, 2013, 5:56:09 AM2/7/13
to zx...@googlegroups.com
Don't know what you mean, sorry. Could you be more specific?

El jueves, 7 de febrero de 2013 11:52:03 UTC+1, Sean Owen escribió:
How about the barcode?

Sean Owen

unread,
Feb 7, 2013, 6:36:00 AM2/7/13
to zx...@googlegroups.com
You say you have a barcode that doesn't contain a certain character, and as far as I know it's working. Surely the best thing is to show the thing you are scanning? 
Show an image of a barcode you're trying to scan.

Alejandro Berzosa Iglesias

unread,
Feb 7, 2013, 6:40:21 AM2/7/13
to zx...@googlegroups.com
For example this pic: http://www.axicon.com/images/SSCCsampleEAN128.gif

Should have the FNC1 char since it's an EAN-128

Sean Owen

unread,
Feb 7, 2013, 6:50:15 AM2/7/13
to zx...@googlegroups.com
I'm having some trouble scanning this, is there a larger image?
Or, can you dump the contents of the barcode as scanned, as bytes? That alone may suggest the issue. Double-check that it is actually being read as Code 128, and not finding a false positive from another format!

Alejandro Berzosa Iglesias

unread,
Feb 7, 2013, 6:53:20 AM2/7/13
to zx...@googlegroups.com
Any GS1-128 or EAN-128 (wich are the same) should have this FNC1 char. I'm just looking at Google for images...

Here you have a larger image: http://www.123edi.com/images/gs1128-label.jpg

Sean Owen

unread,
Feb 7, 2013, 7:10:13 AM2/7/13
to zx...@googlegroups.com
Ah, that's right. FNC1 isn't translated in Code 128. I think the idea was that in QR codes it is sometimes translated as ASCII 29. There's no real translation to ASCII in Data Matrix, but I made up that it also translates to 29. Code 128 doesn't behave that way, yet. Hmm, on the one hand, changing it could break callers, but, it also seems useful to give this a representation in the string. If I scan the Code 128 barcode, and the result has this character, and it's used for (say) a lookup online, I wonder if that causes it to fail? That's my only concern.

Is it sufficient for your purpose to maintain a local modification? You can easily make it works this way. Look for handling of FNC{1,2,3,4} in Code128Reader.java and append ((char) 29) instead of doing nothing.

Alejandro Berzosa Iglesias

unread,
Feb 7, 2013, 7:26:26 AM2/7/13
to zx...@googlegroups.com
Ok, that worked for me. The change that woks is the one on the CODE_CODE_C case of the switch. Thanks a lot!

Sean Owen

unread,
Feb 8, 2013, 6:00:27 PM2/8/13
to zx...@googlegroups.com
Yeah, I suppose the issue is that the GS1 standards are on top of the underlying format standards. It implies an interpretation for these formats that does not necessarily hold when not being used as a GS1 barcode.

But as I recall, and I am not sure if this is correct, that FNC1 is only used in practice as part of a GS1 barcode in Data Matrix (?) -- so that's why it gets the GS1-style translation as a default.

I am not as sure about Code 128. My question is whether FNC1 commonly appears in Code 128 outside a GS1 interpretation and really needs to be interpreted as no character at all.

If that's not true, I think Code 128 should also translate FNC1 as ASCII 29. Any comments on that specific point?

Sean Owen

unread,
Feb 11, 2013, 11:48:50 AM2/11/13
to zx...@googlegroups.com
I don't have the Code 128 spec, but, it seems that FNC1 is used similarly in QR code and DM, and so it's fair to assume that they should behave about the same way.

I don't know if the DM implementation is right. It translates all FNC1 as ASCII 29, but the "1st and 2nd position FNC1" are supposed to be treated specially -- but, I think that is something for upstream callers (?)

I propose, I suppose, making Code 128 at least consistent with DM: translate all FNC* to ASCII 29. It may or may not be correct; it may at least be correct-er.

Are there any more authoritative proposals out there? I don't understand this well enough to know what is intended by the specs or used in practice.

Lachezar Dobrev

unread,
Feb 11, 2013, 8:13:03 PM2/11/13
to Sean Owen, zx...@googlegroups.com
I'm not sure about DM or QR usa of [FNC1], but in GS1-128 (which is
a CODE-128 with specification for content) uses [FNC1] to combine
multiple «instructions» into a single bar-code.
I would like to raise a hand and propose the reader to strip [FNC1]
from the text. This is what most (if not all) hand-held bar-code
readers do by default. If anyone is interested in handling the [FNC1]
then they should process the raw bytes anyway.

The Wikipedia article on GS1-128 has a bit of information on the
subject, I believe can shed some light.

2013/2/11 Sean Owen <sro...@gmail.com>:
> --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "zxing" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to zxing+un...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

Wilfried Weigelt

unread,
Feb 14, 2013, 11:49:07 AM2/14/13
to zx...@googlegroups.com
"Actually this says, that the [FNC1] should be translated to
0x1D(GS), but not if it's the first or second «character»."
-- Correct --
===================
The quoted paragraphs are just references. I cannot post the standards because they are copyright protected by ISO. 

==================================
"What to do with the leading [FNC1]?"

If the symbology identifier is also included in the scan string it must be set properly and the FNC1 must be deleted from the string. 
If the software is "knowing" the data structure behind then it expects and parses the GS1 Applications identifier data structure gives the data back in an already presorted way. ATTENTION - This is leaving the pure decoder and goes into data interpretation. The question is if a decoder library may provide such a data related functionality or not. If it is in the decoder then this is a function which is used in the same way for all symbologies containing GS1 structured data.
(except GS1 Databar - no leading FNC1 is allowed, this symbology is designed for GS1 structured data only)

With no symbology identifier and no data structure parsing the first FNC1 is also deleted from the string. Its then however useless because the application which receives the data does not get anymore the information which data structure type has been used. I suggest therefore to translate, by default setting, the found symbology together with the 1st/2nd to the appropriate symbology identifier and send this together with the decoded data. 


==================================================================
  *apologies. Tab-Sent prematurely*

  Just noticed, that you sent this reply to me ONLY. (I took the wrong anwer button, sorry)
  Unless there is some hush-hush about this you should send the reply
to the List instead, so that other users and the developers can see
it.

  Actually this says, that the [FNC1] should be translated to
0x1D(GS), but not if it's the first or second «character». What to do
with the leading [FNC1]?

  I can not get the meaning of the quoted paragraphs. The wording is too
complex for me.

2013/2/12 Wilfried Weigelt <wwreav...@gmail.com>:
ISO/IEC 15417 Annex B describes the handling of FNC 1 characters. This is
normative.
"FNC1 in the third or subsequent character position is transmitted as the
ASCII character 29 (GS)."
Code 128 Annex C, Symbology Identifier ]C0
GS1-128 is Code 128 Annex C, Symbology Identifier ]C1 (FNC1 at the first
position)
Concatendation of data : Annex C, Symbology Identifier ]C4 - controlled by
ISBT-128

ISO/IEC 16022 DataMatrix FNC1 handling
Chapter 5.2.4.6  ; 5.6.4 ; 11.1 ; 11.2 ; 11.5 ; Annex N Symbology
Identifier,
(similar to Code 128, but more options)

ISO/IEC 18004  QR-Code FNC1 Handling
Chapter
6.3.8 FNC1 mode
Table 2
Chapter 6.4.4
"In FNC1 mode symbols the FNC1character may occur in the data. It is
represented in Alphanumeric mode by
the character %. Refer to 6.4.8.1, 6.4.8.2 and 13.4 for details of the
encoding and transmission of FNC1
and %. "
Chapter 6.4.8 FNC1 modes (depending : Byte modes - translate to ASCII 29,
alphanumeric mode - translate to % becasue only 43 characters available in
alphanumeric mode)
Chapter 13.4
Annex F - Symbology Identifier



Am 12.02.2013 02:13, schrieb Lachezar Dobrev:

   I'm not sure about DM or QR usa of [FNC1], but in GS1-128 (which is
a CODE-128 with specification for content) uses [FNC1] to combine
multiple «instructions» into a single bar-code.
   I would like to raise a hand and propose the reader to strip [FNC1]
from the text. This is what most (if not all) hand-held bar-code
readers do by default. If anyone is interested in handling the [FNC1]
then they should process the raw bytes anyway.

   The Wikipedia article on GS1-128 has a bit of information on the
subject, I believe can shed some light.


Reply all
Reply to author
Forward
0 new messages