Unicode text is not recognized as unicode.

Questions and answers on how to use XLSReadWriteII 3/4/5.
Post Reply
notricky
Posts: 2
Joined: Mon Jul 10, 2017 8:20 pm

Unicode text is not recognized as unicode.

Post by notricky »

Code: Select all

function TXc12DataSST.AddString(AText: AxUCString): integer;
...
    if IsUnicode(AText) then
      P := MakeString(AText)
    else
      P := MakeCompressedString(AText);  // always goes here, despite that AText = 'Hüco'
...
end;
......

function TXc12DataSST.IsUnicode(const S: AxUCString): boolean;
var
  i: integer;
  W: word;
begin
  if not FCompress then
    Result := True
  else begin
    for i := 1 to Length(S) do begin
      W := Word(S[i]);       // This is not tested. Need a multibyte char.
      if ((W and $FF00) <> 0){ or (ByteType(S[i], 1) <> mbSingleByte)} then begin
        Result := True;
        Exit;
      end;
    end;
    Result := False;
  end;
end;

The text is normally retrieved from MS SQL (nvarchar) and normally held in String variable.

AText = 'Hüco'

So it is never recognized as unicode. Why?

XLSRWII 5 is the issue.
notricky
Posts: 2
Joined: Mon Jul 10, 2017 8:20 pm

Re: Unicode text is not recognized as unicode.

Post by notricky »

In order to overcome this issue I had to set CompressStrings option to False.

Code: Select all

TXLSReadWriteII4.CompressStrings := False;
Post Reply