I connect to the mail, put the contents of the letter in Memo1, and there krakazyabli. Can anyone tell me how to avoid this?

IdPOP31.Host:='pop3.хостинг.ru'; IdPOP31.Port:=110; IdPOP31.Username:='логин'; IdPOP31.Password:='пароль'; IdPOP31.Connect; IdMessage1.Clear; if IdPOP31.CheckMessages<1 then Break; IdPOP31.Retrieve(1,IdMessage1); Memo1.Clear; Memo1.Lines:=(IdMessage1.MessageParts.Items[0] as TIdText).Body; 
  • four
    Here, figure out what the [krakozyabry] [1] [1]: img0.joyreactor.cc/pics/post/full/… - NMD
  • Here is the text, if I am not a secret. , RTDRYOYNBFEMSHUFPHP forum of nBTLPCHULYE zhPTKhNSH.This topic is located at izhevsk.ru/forummessage/71/4287775-0.html#m3264463 CHPP FTP RTBCHYMSHOP !!! MHYUYE VSH CHPPWEE OYUYEZP OE Ryyubmy!)} - Aleksandr
  • This is KOI8-R launched in Win-1251 - kot-da-vinci
  • Is there any method of translating text information into the necessary encoding? @ kot-da-vinci You have not once helped me in this forum, pointed out my mistakes, for which I am grateful to you. I really wonder what your programming experience is? - Aleksandr
  • @Aleksandr Let's just say, I was engaged in programming "for myself" 10 years ago. And I work as a programmer for almost 3 years. It looks like Delphi7 does not have the means to translate the encodings, you have to reinvent the wheel :) Here is a discussion of your problem: delphimaster.net/view/2-1288068191 CharSet may be empty if the encoding in the headers is not specified or specified in the wrong place. For example, in the subject line or in the "to" field. - kot-da-vinci

2 answers 2

IdMessage1 surely must contain a field / method that tells in what encoding the text of the letter, the encoding is usually indicated in the service headers of the letters. Well, then it remains only to convert the text to the desired encoding.

UPD: CharSet may be empty if the encoding in the headers is not specified or is indicated in the wrong place. It can be specified in the subject line of the letter or in the "to" field. For example:

Subject: =? Koi8-r? B? 6c7Gz9LNwcPJ0Q ==? =

Discussion of this issue here .

  • That's right! - IdMessage1.CharSet Returns the string (string) Placed it in ShowMessage, but nothing was displayed in the message ( - Alexander
  • The TIdMessage class has a ProcessHeaders method. ProcessHeaders is in the message. Try running ProcessHeaders before checking the CharSet field. - kot-da-vinci
  • IdMessage1.ProcessHeaders; ShowMessage (IdMessage1.CharSet); Unfortunately, the result is the same ( - Aleksandr

I remember that in Uses, something similar to StrUtils or Windows (I won’t say exactly) wrote and various interesting functions appeared, such as OemToChar and vice versa - it helped in similar situations. StringList on the fly all converted to the desired encoding.

http://www.programmersforum.ru/showthread.php?t=66815 - look still here, it can and will help.

  • On the XE3, these functions are built-in enough now, the Semerochka has forgotten))) - IvanCoFox
  • Exactly !!! StrUtils !!! Inside this library there are many string utilities for encodings, for comparing strings and for others with strings of operations. - IvanCoFox