Thread View: borland.public.cppbuilder.internet.socket
1 messages
1 total messages
Started by akhramovichsa
Tue, 27 Jan 2009 16:33
TIdMessage SaveToFile stores with signs letter ???????
Author: akhramovichsa
Date: Tue, 27 Jan 2009 16:33
Date: Tue, 27 Jan 2009 16:33
85 lines
4322 bytes
4322 bytes
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: "aaaa@com.net" <aaaa@com.net>
Subject: ???????? ?????????
To: bbbb@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;
)
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads