LazUtf8: correct a StartCharIndex < 1 in Utf8Copy. Reason: consistent with System.Copy().

This commit is contained in:
Bart 2025-04-07 20:01:14 +02:00
parent c0f4946828
commit 162cbbfc1b

View File

@ -1125,6 +1125,8 @@ var
EndBytePos: PChar;
MaxBytes: PtrInt;
begin
if StartCharIndex < 1 then
StartCharIndex := 1; //Copy() does this correction too
StartBytePos:=UTF8CodepointStart(PChar(s),length(s),StartCharIndex-1);
if StartBytePos=nil then
Result:=''