Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

TIdMessage SaveToFile stores with signs letter ???????

20 views
Skip to first unread message

akhram...@gmail.com

unread,
Jan 27, 2009, 11:33:31 AM1/27/09
to
There is an application e-mail client to send and receive letters,
written in BDS2008.
Using the mail through Indy10.
With the formation of a new writing component, through TIdMessage,
first letter is saved in a file for later shipment.

TIdMessage * IdMessageSave = new TIdMessage (NULL);

IdMessageSave-> Clear ();
IdMessageSave-> MessageParts-> Clear ();

IdMessageSave-> CharSet = "koi8-r";
IdMessageSave-> AttachmentEncoding = "MIME";
IdMessageSave-> ContentType = "text / plain; charset = \" koi8-r
\ ";";
IdMessageSave-> Encoding = meMIME;

IdMessageSave-> From-> Address = WIN_TO_KOI (this-> From);
IdMessageSave-> Recipients-> EMailAddresses = WIN_TO_KOI (this->
To);
IdMessageSave-> Subject = WIN_TO_KOI (this-> Subject);
IdMessageSave-> Body-> Text = WIN_TO_KOI (this-> Body);

IdMessageSave-> SaveToFile (this-> Path);
IdMessageSave-> ~ TIdMessage ();


When migrating to the CodeGear RAD Studio 2009 letter written to the
file, but instead of Cyrillic letters are displayed signs of "??????"
Here's an example of a saved message:

From: "aa...@com.net" <aa...@com.net>
Subject: ???????? ?????????
To: bb...@com.net
Content-Type: text / plain; charset = "koi8-r";
MIME-Version: 1.0
Date: Sun, 25 Jan 2009 18:39:11 +0300

???? ??????????, ???????? ?????? ??????? ?????????? ? ????????? ??????, ?????????? ??
BDS2008.
?????? ? ?????? ?????????????? ????? Indy10.
??? ???????????? ?????? ?????? ????? ????????? ?
IdMessage, ?????? ??????? ??????????? ? ???? ??? ??????????? ????????


Tried to maintain through the flow, the result is the same, the flow
has become question marks
TMemoryStream * buffer = new TMemoryStream ();
IdMessageSave-> SaveToStream (buffer);

TStringList * mail_raw_str = new TStringList ();
buffer-> Position = 0;
mail_raw_str-> LoadFromStream (buffer);
mail_raw_str-> SaveToFile (this-> Path);


Search on the Internet suggested that the problem is hidden in Indy in
the method TIdMessage:: SaveToStream (...).
Actually the question, how to fix this bug?


PS: The function WIN_TO_KOI
UnicodeString WIN_TO_KOI (UnicodeString str)
(
UnicodeString res_str;
UnicodeString SKoi =
"ЈіеАБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюя;
UnicodeString SWin =
"eETyuabtsdefghiyklmnopyarstuzhvyzsheschchYuABTsDEFGHIYKLMNOPYaRSTUZhVYZShESchCh;
int k;
for (int i = 1; i <= str.Length (); i + +)
(
int pos = AnsiPos (str [i], SWin);
if (pos == 0) (res_str + = str [i];)
else (res_str + = SKoi [pos];)
)
return res_str;
)

0 new messages