Help to read the text correctly. When connecting (Delphi, Indy) to a remote server (TCP), a string comes (it contains both English and Russian characters) a string comes in which English characters are displayed correctly, and Russian in the form of black diamonds with a question mark. alt text

Help to read the lines correctly, thanks.

  • Most likely utf8 - alexlz
  • one
    The server is obliged to report in what encoding its response. Do not guess. - VladD

1 answer 1

This is definitely utf8. What version of Delphi?

TEncoding.UTF8.GetString(const Bytes: TBytes): string; 

You send the received bytes there, at the output you get a regular Unicode string, which can be output directly to the memo.

  • @ kot-da-vinci I like regular-unicode string expressions. Those. utf8 is unusual, and utf16 is normal. Are these dolphins so smart, or do they affect Windows? - alexlz
  • @alexlz, under the "regular Unicode string", I mean the Unicode, in which the Delphi stores the strings when we write s := 'bla-bla' or Button1.Caption := 'Превед!' . - kot-da-vinci
  • @ kot-da-vinci Windows specialists say that now they have utf-16 in Windows (the main part of the characters is 2b, which is not 4b). The fact that fits in 2b, coincides with the previous encoding ucs-2, which utf-16 and replaced. - alexlz
  • one
    @ kot-da-vinci Delphi XE5. Thanks for the help. - rareMax