Hi Luc,
This is what we have for code, are you using anything like this?
Any obvious mistakes to be spotted?
EncodeBarcode128(pText : Text[250]) RetVal : Text[250]
// How to encode a 128 barcode:
//
// Each character has a value ranging from 0 to 105. This value is used to calculate the check
// character for each symbol.
//
// The check character is a Modulus 103 Checksum that is calculated by summing the start code
// value plus the product of each character position (most significant character position equals 1)
// and the character value of the character at that position. This sum is divided by 103. The
// remainder of the answer is the value of the Check Character (which can be looked up from the
// table). Every encoded character is included except the Stop and Check Character.
//
//
// Example: BarCode 1
// Message : Start B B a r C o d e 1
// Value 104 34 65 82 35 79 68 69 0 17
// Position: - 1 2 3 4 5 6 7 8 9
// Calculate Total: 104 + (34x1) + (65x2) + (82x3) + (35x4) + (79x5) +
// (68x6) + (69x7) + (0x8) + (17x9) = 2093
// 2093/103 = 20 remainder 33
// 33 = A
// Final message: (Start B)BarCode 1(A)(STOP)
//Codes for font from mibuso download CODE B
StartChar:=154;
StopChar:=156;
Checksum:=154;
FOR i:=1 TO STRLEN(pText) DO BEGIN
currentchar:=pText[i];
Checksum := Checksum +(i*(currentchar-32));
END;
ChecksumChar:= Checksum MOD 103;
MESSAGE('checksum mod 103: ' + FORMAT(Checksum MOD 103));
//KEENSOFT
ChecksumChar:= ChecksumChar+32;
{
CASE ChecksumChar OF
0: ChecksumChar:= 176; // B0h
1..94: ChecksumChar:= ChecksumChar + 32;
95..101: ChecksumChar:= ChecksumChar + 105;
102: ChecksumChar:= 213; // D5h
END;
}
//KEENSOFT
MESSAGE('Checksum: ' + FORMAT(Checksum));
// convert SPACE to ALT+0128
pText:=CONVERTSTR(pText,' ','â–‘');
MESSAGE('Checksum char: ' + FORMAT(ChecksumChar));
RetVal:=STRSUBSTNO('%1%2%3%4',StartChar,pText,ChecksumChar,StopChar);
EXIT(RetVal);