[liblouis-liblouisxml] Issue with Calling LibLouis Translate in Latest Version

  • From: Dang Hoai Phúc <danghoaiphuc@xxxxxxxxx>
  • To: liblouis-liblouisxml@xxxxxxxxxxxxx
  • Date: Sun, 19 Apr 2020 06:01:33 +0700

Dear All,

May I have your support for this issue. I have no problem to translate with LibLouis 3.6 but with output issues with latest version like 3.12 or 3.13. This occurs with all other tables, not only the en-us-g1.ctb. My code is written in Delphi. Please help to examine the code below and look forward to your support.

function lou_translateString(const tableList: PAnsiChar; const inbuf: PAnsiChar; var inlen: Integer;

outbuf: PAnsiChar; var outlen: Integer; typeform: Pointer; spacing: PAnsiChar; mode: Integer): Integer;

stdcall; external 'liblouis.dll';

procedure TForm1.Button2Click(Sender: TObject);

var

inStr, outStr: String;

table: AnsiString;

inlen, outlen, mode: Integer;

begin

inStr := 'hello world’;

table := 'tables312\en-us-g1.ctb';

  mode := 0;

inlen:= Length(inStr);

outlen:= 20* inlen;

SetLength(outStr, len);

FillChar(outStr[1], 2*len, 0);

lou_translateString(PAnsiChar(table), PAnsiChar(inStr), inlen, PAnsiChar(outStr), outlen, nil, nil, mode);

ShowMessage(outStr);

end;

Above code outputs successfully with 'hello world" with 3.6 version.

but with LibLouis 3.12, it has issue. The output is: outStr = ''''#0'\'#0'z'#0'0'#0'0'#0'6'#0'5'#0'0'#0'0'#0'6'#0'8'#0''''#0''''#0'\'#0'z'#0'0'#0'0'#0'6'#0'c'#0'0'#0'0'#0'6'#0'c'#0''''#0''''#0'\'#0'z'#0'0'#0'0'#0'2'#0'0'#0'0'#0'0'#0'6'#0'f'#0''''#0''''#0'\'#0'z'#0'0'#0'0'#0'6'#0'f'#0'0'#0'0'#0'7'#0'7'#0''''#0''''#0'\'#0'z'#0'0'#0'0'#0'6'#0'c'#0'0'#0'0'#0'7'#0'2'#0''''#0''''#0'\'#0'y'#0'd'#0'0'#0'0'#0'6'#0'4'#0''''

If I save the outStr into file with unicode format, it will have the result like this:

'\z00650068''\z006c006c''\z0020006f''\z006f0077''\z006c0072''\yd0064'

With this output, it is actually the 'hello world' in character hexacodes but it doesn't output as with LibLouis 3.6.

I downloaded the source code of two versions, 3.6 and 3.12; then compared the call of LibLouis translate function, it seems not having any differences.
I am looking forward to your help on this issue.
Thanks so much and best regards,
Phúc

Attachment: 86CDD766205B4CA0AA8FF256E9D86198.png
Description: PNG image

Other related posts: