How to fix a bug in system class BarcodeCode128 ?

Hello,

I found out that AX 2009 BarcodeCode128 class has a bug in encodeString() method.

The problem is that it doesnt detect space (string is uppercase letters and numbers with space character), and even worse this method assigns FNC 3 symbol, this means reset string.

Another problem, if the string contains upper, lowercase letters, numbers and space, it makes code even unreadable.

Maybe someone had this bug and know how to fixed it?

Thanks in advance.

Hi,

I’m using AX 2009 and I had the same problem, in the encodeString() method around line 110:

tichr++;

if (shift)
{
if (codeset == #CodesetA)
rtnint = (tcchr <= 31 || tcchr > 127) ? #NotFound : tcchr - 31; // is tcchr in codeset B?
else
{
rtnint = (tcchr < 0 || tcchr > 127) ? #NotFound : (tcchr <= 31) ? tcchr + 65 : tcchr - 31; // is tcchr in codeset a
if (charVal == 32)
{
//rtnint = 95 <========== comment this line and add rtint = 1 like follows
rtnint = 1;

It solved my problem, my barcode are readable.

Hope it helps, please verify solution if it solves your problem

regards,

Thomas

if (codeset == #CodesetA)

{

if (tcchr == 32)

rtnint = 1;

else

rtnint = (tcchr < 0 || tcchr > 127) ? 96 : (tcchr <= 31) ? tcchr + 65 : tcchr - 31; // is tcchr in codeset a

}

else

{

if (tcchr == 32)

rtnint = 1;

else

rtnint = (tcchr <= 31 || tcchr > 127) ? #NotFound : tcchr - 31; // is tcchr in codeset B?

}

This is how I solved today this problem by myself. And I know why it is made so. It is used that if a string has space, so what they made, that barcode would reset the string. This is not a BUG, this is the logic of Microsoft :slight_smile: