I'm working with web service and I have a problem with an invalid character was found in text content. I don't have much experience with encoding so I decided to pass the data as TByteDynArray
. Here is the code I use from this answer.
class function StringHelper.StringToByteArray(value: string): TByteDynArray;
begin
SetLength(Result, Length(value) * SizeOf(Char));
if Length(value) > 0 then
begin
Move(value[1], Result[0], Length(value) * SizeOf(Char));
end;
end;
I had success with converting string
to TByteDynArray
, but I don't know how to convert it back from TByteDynArray
to string
.