mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-11 16:56:01 +02:00
lazreport: fixed UTF8Desc to always return a valid UTF8 string
git-svn-id: trunk@47750 -
This commit is contained in:
parent
69edc4d8c0
commit
d85758cb35
@ -920,19 +920,10 @@ begin
|
||||
end;
|
||||
|
||||
function UTF8Desc(S: string; var Desc: string): Integer;
|
||||
var
|
||||
i,b: Integer;
|
||||
begin
|
||||
i := 1;
|
||||
Result := 0;
|
||||
SetLength(Desc, Length(S));
|
||||
while i<=Length(s) do begin
|
||||
b := UTF8CharacterStrictLength(@S[i]);
|
||||
inc(i,b);
|
||||
inc(Result);
|
||||
Desc[Result] := Char(b);
|
||||
end;
|
||||
Setlength(Desc, Result);
|
||||
Desc:=S;
|
||||
UTF8FixBroken(Desc);
|
||||
Result:=length(Desc);
|
||||
end;
|
||||
|
||||
function UTF8Char(S: string; index: Integer; Desc: string): TUTF8Char;
|
||||
|
Loading…
Reference in New Issue
Block a user