In Delphi XE7, we are converting some values from string to bytes and from bytes to string using:
MyBytes := TEncoding.Unicode.GetBytes(MyString);
and
MyString := TEncoding.Unicode.GetString(MyBytes);
I would like to write my own functions that results same values on Delphi-2007. I'm really not skilled about chars encoding, I suppose I should use WideString
type in Delphi-2007 (It's right?)
function StringToBytes(AValue : WideString) : TBytes;
begin
Result := //...
end;
function BytesToString(AValue : TBytes) : WideString;
begin
Result := //...
end;
Could someone help me in writing this two functions?