Assign [array of byte] to a Variant with no Unicode conversion
问题 Consider the following code snippet (in Delphi XE2): function PrepData(StrVal: string; Base64Val: AnsiString): OleVariant; begin Result := VarArrayCreate([0, 1], varVariant); Result[0] := StrVal; Result[1] := Base64Val; end; Base64Val is a binary value encoded as Base64 (so no null bytes). The ( OleVariant ) Result is automatically marshalled and sent between a client app and a DataSnap server. When I capture the traffic with Wireshark, I see that both StrVal and Base64Val are transferred as