str: string;
bytesof(str) is different TEncoding.UTF8.GetBytes(str)。。
BytesOf(str) will return the raw bytes of the
str's characters as-is.
If
string is
AnsiString, then
TEncoding.UTF8.GetBytes(str) will first have to convert
str to Unicode using
DefaultSystemCodePage, which will corrupt data if
DefaultSystemCodePage is set to a different encoding than
str is using. And then
GetBytes() will convert the resulting Unicode to UTF-8.
If
string is
UnicodeString, then that
DefaultSystemCodePage conversion is skipped, and
GetBytes() will convert
str as-is straight to UTF-8.