What is the best way to convert TBytes (UTF-16) to a string?

后端 未结 3 1535
北荒
北荒 2021-01-05 01:36

What is the best way to convert an array of bytes declared as TBytes to a unicode string in Delphi 2009? In my particular case, the TBytes array has UTF-16 encoded data alre

相关标签:
3条回答
  • 2021-01-05 02:20

    If your TBytes contains UTF-16 characters, look at WideStringOf and WideBytesOf.

    0 讨论(0)
  • 2021-01-05 02:34

    StringOf converts TBytes to a UnicodeString. BytesOf converts a UnicodeString to TBytes.

    0 讨论(0)
  • 2021-01-05 02:39

    I ended up using

    TEncoding.Unicode.GetString( MyByteArray );
    
    0 讨论(0)
提交回复
热议问题