Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

Problem with BarCode 128

edited September 2009 in General
Hi,

Delphi 2009 Update 3, ReportBuilder 11.06

I found error in ppBarCodDrwCmd.pas. You added retyp to AnsiChar on several
places.
For example:
case AnsiChar(FData[1]) of
#208: begin; CurCode := 'A'; Encode(GetChar(103)); Check := 103; end;
#209: begin; CurCode := 'B'; Encode(GetChar(104)); Check := 104; end;
#210: begin; CurCode := 'C'; Encode(GetChar(105)); Check := 105; end;
else

But it is wrong. It change char code (we have UNICODE application and Czech
environment).
And result is error message 'Code 128 must begin with a start code (#208,
#209 or #210)'.

Next problem: If we delete these retyp, all work without error message but
bar code is too long
(approximately twice).

Thanks
Roman Krupicka

Comments

  • edited September 2009
    Another hint:

    You have declaration:
    type
    TppDataBits = array[0..7999] of char;

    var
    lDataBits: TppDataBits;

    FillChar(lDataBits, Length(lDataBits), #0);

    Char in UNICODE has 2 bytes, so FillChar with Length sets only half of
    bytes.
    You had FillChar(lDataBits, SizeOf(lDataBits), #0); in version 10.09 and I
    think that it is OK.
    It fills all bytes - in Ansi and in Unicode version of Delphi...

    Regards
    Roman Krupicka

  • edited September 2009
    Hi,
    I think I found where problem is.

    I tried to use RB's *.dcu in our application and all worked OK. But if I
    used RB's *.pas error occurred.
    I think that it is due to compilation on computer with code page 1250.
    We are using *.pas due to using EurekaLog (error checking).

    You are using mix of AnsiChar and Char in ppBarCod and ppBarCodDrwCmd.

    For example ppBarCod:
    function TppCustomBarCode.GetDefaultData: string;
    begin
    ...
    bcCode128 : Result := #210 + '1234' + #205 + ' abcd';
    ...
    end;

    If I compile on 1250 system I get Result = 'N1234Í abcd', with your dcu I
    get Result = 'O1234Í abcd'.
    Code #210 in code page 1250 is N, in Unicode is O. Code #205 is the same in
    1250 and Unicode.

    I think that you have to change
    bcCode128 : Result := #210 + '1234' + #205 + ' abcd';
    to
    bcCode128 : Result := WideChar(210) + '1234' + WideChar(205) + ' abcd';

    And change AnsiChars to Chars or Ord():
    case AnsiChar(FData[1]) of
    #208: begin; CurCode := 'A'; Encode(GetChar(103)); Check := 103; end;
    #209: begin; CurCode := 'B'; Encode(GetChar(104)); Check := 104; end;
    #210: begin; CurCode := 'C'; Encode(GetChar(105)); Check := 105; end;
    else
    to
    case Ord(FData[1]) of
    208: begin; CurCode := 'A'; Encode(GetChar(103)); Check := 103; end;
    209: begin; CurCode := 'B'; Encode(GetChar(104)); Check := 104; end;
    210: begin; CurCode := 'C'; Encode(GetChar(105)); Check := 105; end;
    else

    if ppCharInset(FData[X], [#208,#209,#210]) then
    to
    if ppCharInArray(FData[X], [WideChar(208),WideChar(209),WideChar(210)]) then

    etc.

    Conclusion: don't use any #X, where X >= 128.

    Delphi 2009 Update 3 + Update 4 DB
    ReportBuilder 11.06
    Windows Vista SP2 Czech - code page 1250

    Thanks
    Roman Krupicka
  • edited September 2009
    Hi Roman,

    Thanks for the information. We are currently looking into a solution for
    this issue and will post here when one is found. Thanks for you patience
    and support.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited September 2009

    I emailed you a patch for RB 11.06 that addresses this issue. Registered
    users of RB 11.06 can email support@digital-metaphors.com and request the
    patch.



    --
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
This discussion has been closed.