New User? Sign Up  |  Sign In  |  Help
Barcode support and
tutorials from IDAutomation
and the community.
Click for the BBB Business Review of this Computers Hardware, Software & Services in Tampa FL
Resolved Questions

Code-128 doesn’t support Latin-1 characters (characters above ASCII)


Hi,

When trying to encode the data “öäü” (Hexadecimal F6 E4 FC of Latin-1) via Code-128 using the .NET Forms Control with the following code …
Bitmap outputImage;
using (var barcode = new Barcode (true))
{
barcode.DoPaint = false;
barcode.SymbologyID = Barcode.Symbologies.Code128;
barcode.ShowText = false;
barcode.DataToEncode = "öäü";

barcode.Resolution = Barcode.Resolutions.Custom;
barcode.ResolutionCustomDPI = "254";
barcode.XDimensionCM = "0.0301";
barcode.NarrowToWideRatio = "1.01";

barcode.BearerBarHorizontal = "0";
barcode.BearerBarVertical = "0";

barcode.LeftMarginCM = (10f * 0.03f + 0.0001f).ToString ();
barcode.TopMarginCM = "0";

barcode.Code128Set = Barcode.Code128CharacterSets.Auto;
barcode.ApplyTilde = false;

barcode.DoPaint = true;
outputImage = (Bitmap)barcode.BMPPicture.Clone ();
}

…we get the following barcode:
image
This barcode consists of a Start Pattern “B” and a Stop Pattern, and no data code words or error correction code words.
This is unexpected since the Code-128 Standard clearly supports the use of characters of Latin-1.
The expectation would look like this:

image
This is a barcode that can be read using several of our hand scanners.
The code words it contains are the following: (separated by ‘|’)
Start-Character “B” | FNC4 | 86 | FNC4 | 68 | FNC4 | 92 | Stop-Character

What we would need is complete support of Latin-1 as stated in the code-128 standard using the FNC4 codeword.

Kind regards,
Roman Brandstetter


04-03-12     12.5 year(s) ago    

  Report Abuse

 

Tim

Best Answer

Roman,

The code 128 standard can only support the first 128 characters in the ASCII table.
This is actually where it gets its name. :)

However, I did find a way to work around it. To encode the same data set the Code128Set property to B and DataToEncode to "ÈvÈdÈ|"
barcode.Code128Set = Barcode.Code128CharacterSets.B;
barcode.DataToEncode = "ÈvÈdÈ|"

It looks like the sample barcode is doing this breakdown for you since each of those characters is two code words.

Posted 12.5 year(s) ago

(0)
(0)
  Report Abuse
 
Find Interesting
 
Email to Others
 
Bookmark
 
Subscribe to Answer Alert
No comments yet.     Be the first to comment.
Other Answers (6)
Thank you for the update Roman,

Concerning the permanent shift issue, I have not been able to recreate the problem.
Both barcodes in your last response scanned with the same value, "öäü".
This may be a scanner setting issue. I was able to get the same result using both the HHP 4600g and SC7-2D barcode scanners.

I will look at the human-readable and see what we can do about getting this in our next release.

Posted 12.5 year(s) ago

(0)
(0)
   Report Abuse
Hi,

Finally...
This would work except for two minor issues.
Using Codeset B it is then only possible to encode values 0x1F-0x5F, 0x60-0x7F, 0xA0-0xDF, and 0xE0-0xFF of all the values from 0-0xFF
That would be okay since that is all the printable characters of Latin-1.
I assume this would work with CodeSet A too, but it could be problematic with automatic mode.
The only problem is that showing the text under the barcode looks like this:

image

Also I would expect that the value 'ÈÈvd|' would give me a barcode that decodes to the same value.
But this does not work out as expected as the permanent mode shift to the 128+ character set does not seem to work.
image

Kind regards,
Roman Brandstetter

Posted 12.5 year(s) ago

(0)
(0)
   Report Abuse
Roman,

I believe we are saying the same thing.
The code snippet sent in my last response does exactly that, it uses the FNC4 as a shift character and creates an identical barcode as the sample you provided. Even though the data underneath looks different.
barcode.Code128Set = Barcode.Code128CharacterSets.B;
barcode.DataToEncode = "ÈvÈdÈ|"

The È is the FNC4 shift character in our library, and this can only be used in either code set A or B. I choose B because it encodes the lowercase characters as is, whereas set A encodes lowercase characters as special functions.

When using the string "ÈvÈdÈ|" this scanned correctly as "öäü".
Please give this a try and let me know how this goes.

Posted 12.5 year(s) ago

(0)
(0)
   Report Abuse
Hi,

Okay, we need this for encoding mode auto since we don't want to bother with the different modes ourselves as long as we can.
I also don't see if there is a possibility to switch between the modes in the barcode without setting the mode for the whole barcode.

About Code-128 and Latin-1:
That sample barcode with the value "öäü" CAN be decoded using several hand scanners!
Annex F of the ISO standard 15417 is all about Latin-1.
And furthermore page 8 of the standard states in chapter 4.3.4.2 explicitly that code word FNC4 CAN be used to encode byte value from 128 to 255 where the original ISO/IEC 646 value of the corresponding codeword is then increased by 128, resulting in a character in the range of 128 to 255!
This is either possible by using FNC4 as a shift character where only the following character is then increased by 128 or by using a double FNC4 where all following codeword values are increased by 128 unless there is a double sequence of FNC4 which ends the sequence of characters above 128.

So I'm sorry but stating that Code-128 does not support Latin-1 is simply not true.
Therefore I am wondering if you are going to fix that issue or if it will just stay that way.
If you say it was possible to encode Latin-1 characters using the library via some workaround, please send me a snippet to produce the barcode with the value "öäü".
You can look up their Latin-1 values on Wikipedia http://en.wikipedia.org/wiki/Latin-1.

I didn't find any reference to FNC4 in the source code, so I highly doubt that it is possible.

Kind regards,
Roman Brandstetter

Posted 12.5 year(s) ago

(0)
(0)
   Report Abuse
Hi,

Thanks for your quick answer.
Yes, I know, that this is currently the case. But the standard explicitly states the support of Latin-1 characters.
So what you are saying is that the library does not conform to the standard?

Kind regards,
Roman Brandstetter

Posted 12.5 year(s) ago

(0)
(0)
   Report Abuse
The Code 128 barcode symbology will only encode characters listed in its character set:
https://www.idautomation.com/code128faq.html#Code-128CharacterSet

Posted 12.5 year(s) ago

(0)
(0)
   Report Abuse
Email this question link to friends
You must enter an email address, if name is entered or vice-versa for each friend.
Friend #1 -
Friend #2 -
Friend #3 -
Friend #4 -
Friend #5 -
  Your comment on this question
  |         |  
bold  italic  underline  strike       big  small       superscript  subscript 
  Allows to add a link. Added links would only be converted to actual clickable link, when the domain of the link is white-listed by administrator.
Caption :
Link URL :
(Must starts with "http://")
Add  |   Cancel
  Allow to insert an image. Must be among the following file types - *.jpg, *.gif, *.png & *.bmp.
Image Url :   Upload New
(Image url must always starts with " http:// ")
Width : pixels
(Must not be greater than 450px. Enter 0px for no resize)
Add  |   Cancel
  Allow to insert YouTube video. Insert the video embed code.
Embed Code :
Add  |   Cancel
Up to 5000 Characters are allowed. Current Count: 0
  Your comment on this answer
  |         |  
bold  italic  underline  strike       big  small       superscript  subscript 
  Allow you to add a link. Added links would only be converted to actual clickable link, when the domain of the link is white-listed by administrator.
Caption :
Link URL :
(Must start with "http://" or "https://")
Add  |   Cancel
  Allow to insert an image. Must be among the following file types - *.jpg, *.gif, *.png & *.bmp.
Image Url :   Upload New
(Image url must always start with "http://" or "https://")
Width : pixels
(Must not be greater than 450px. Enter 0px for no resize)
Add  |   Cancel
  Allow to insert YouTube video. Insert the video embed code.
Embed Code :
Add  |   Cancel
Up to 5000 characters are allowed. Current Count: 0

You may answer and comment on any thread according to the Terms and Conditions.

 © Copyright 2021 IDAutomation.com, Inc., All Rights Reserved. Legal Notices.

 Barcode Fonts | Components | Scanners | Support | Contact Us
Training Videos on YouTube Join us on Google Plus Join us on LinkedIn Follow us on Twitter Like us on Facebook