Why not do it like this?Code: Pascal [Select][+][-]procedure TSimpleMsgPack.setAsString(pvValue: string);var Len: Cardinal;begin FDataType := mptString; Len:= Length(pvValue) * SizeOf(Char); SetLength(FValue, Len); if Len > 0 then Move(pvValue[1], FValue, Len);end;It is much sleeker and should not cause any problems :-)
I will listen! But it was honestly just a guess guys! I am not a computer scientist.The LazUTF8 unit, as far as I know, did not prevent the error. Strings with length 0 will raise the error regardless of it.