ok, below you will find the source for the problem..... if I put the ticket no. 123456789012 into the converting function I get the following code 'ÉÄ!7Mcy! 2 RË the right return value (formated for code128 barcode) have to be Ê,BXnz,VË
$chars = array();
$chrs = array();
function ConvertToCode128( $Ticket )
{
$l = strlen( $Ticket );
$chars[0] = '';
for( $i=1; $i <= $l; $i++ )
{
$chars[$i] = substr( $Ticket, $i-1, 1 );
}
$ind = 0;
$temp = $chars;
$start = 104;
$mode = 0;
$m = 1;
for( $i=1; $i<=$l+1; $i++ )
{
$sw = true;
if( $i < $l + 1 )
{
if(ord($temp[$i]) > 47 && ord($temp[$i]) < 58) $digit = 1; // Wenn Position eine Ziffer ist
if( ($mode=0 && !isset($digit)) || ($mode=1 && isset($digit)) ) $sw = false;
}
if( $mode==0 )
{
if( $sw )
{
$mode = 1;
$ind = $i;
}
else
{
$chrs[$m] = ord($temp[$i]) - 32;
$m++;
}
}
elseif( $sw )
{
if( $i-$ind < 4 )
{
for( $j=0; $j <= $i-$ind-1; $j++ )
{
$chrs[$m+$j] = ord( $temp[$ind + $j] ) - 32;
}
$m = $m+$i-$ind;
if( $i < $l+1 )
{
$chrs[$m] = ord( $temp[$i] ) - 32;
$m++;
}
}
else
{
if( $ind == 1 ) $start = 105;
else $chrs[$m] = 99; $m++;
$n = floor( ($i - $ind) / 2 );
for( $j = 0; $j <= $n - 1; $j++ )
{
$chrs[$m + $j] = 10 * $temp[$ind + 2 * $j] + $temp[ $ind + 2 * $j + 1 ];
}
$m = $m + $n;
if( $i < $l+1 ) $chrs[$m] = 100; $m++;
if( fmod( $i-$ind, 2 ) == 1 ) $chrs[$m] = ord( $temp[$i-1] ) - 32; $m++;
if( $i < $l+1 ) $chrs[$m] = ord( $temp[$i] ) - 32; $m++;
}
$mode = 0;
}
}
$check = $start;
for( $i=1; $i <= $m-1; $i++ )
{
$check = $check + $chrs[$i] * $i;
}
$chrs[$m] = fmod( $check, 103 );
for( $i=1; $i <= $m; $i++ )
{
if( $chrs[$i] < 96 ) $chrs[$i] = Chr( $chrs[$i] + 32 );
else $chrs[$i] = Chr( $chrs[$i] + 97 );
}
$convert = Chr( $start + 97 ) . implode( '', $chrs ) . Chr(203);
return $convert;
}