From d85758cb35acbf63b3a8d3c62d9e6dbe10fe9904 Mon Sep 17 00:00:00 2001 From: mattias Date: Fri, 13 Feb 2015 20:40:29 +0000 Subject: [PATCH] lazreport: fixed UTF8Desc to always return a valid UTF8 string git-svn-id: trunk@47750 - --- components/lazreport/source/lr_utils.pas | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/components/lazreport/source/lr_utils.pas b/components/lazreport/source/lr_utils.pas index bac099d6e2..f1ed4706c8 100644 --- a/components/lazreport/source/lr_utils.pas +++ b/components/lazreport/source/lr_utils.pas @@ -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;