HTMLContent := TTntStringList.Create; (unicode
support string list)
HTMLContent.Text := tmp; (tmp is
widestring)
htmlContent.SaveToStream(htmlPart.DecodedLines);
htmlPart.Primary
:= 'text';
htmlPart.Secondary := 'html';
htmlPart.Description
:= 'HTML text';
htmlPart.Disposition :=
'inline';
htmlPart.CharsetCode := UTF_8;
htmlPart.EncodingCode
:= ME_QUOTED_PRINTABLE;
htmlPart.EncodePart;
htmlPart.EncodePartHeader;
finally
HTMLContent.Free;
end;
the
above resulted with what u can see in the attachment
HTMLContent := TStringList.Create; (not
unicode)
try
HTMLContent.Text
:= WideStringToStringEx(tmp,CP_UTF8); (conversion that worked perfect in text
part)
htmlContent.SaveToStream(htmlPart.DecodedLines);
htmlPart.Primary :=
'text';
htmlPart.Secondary :=
'html';
htmlPart.Description := 'HTML
text';
htmlPart.Disposition :=
'inline';
htmlPart.CharsetCode :=
UTF_8;
htmlPart.EncodingCode :=
ME_QUOTED_PRINTABLE;
htmlpart.TargetCharset := UCS_2; /
UTF_8;
htmlPart.EncodePart;
htmlPart.EncodePartHeader;
finally
HTMLContent.Free;
end;
בתאריך 10/03/2007 20:02:10, Lukas Gebauer - [EMAIL PROTECTED]
כתב:
> htmlPart := Msg2.AddPart(MimePart);
> HTMLContent
:= TTntStringList.Create; (unicode support string
> list) try
>
HTMLContent.Text := tmp; (tmp is widestring)
>
htmlContent.SaveToStream(htmlPart.DecodedLines);
> htmlPart.Primary :=
'text';
> htmlPart.Secondary := 'html';
> htmlPart.Description :=
'HTML text';
> htmlPart.Disposition := 'inline';
>
htmlPart.CharsetCode := UTF_8;
> htmlPart.EncodingCode :=
ME_QUOTED_PRINTABLE;
> htmlPart.EncodePart;
>
htmlPart.EncodePartHeader;
> finally
> HTMLContent.Free;
>
end;
> after EncodePart, the result is 1 character
> and it seems
that 1 of the first characters when loading the stream is #0
> which is
null so the decoding ends in the beginning what am i missing?
No, you
forgot to set charset encoding used in DecodedLines stream.
Synapse asumes
system codepage as default, and it is wrong encoding in
your case. It is
probably UCS_2. So, set (before EncodePart, of
course!):
htmlpart.TargetCharset := UCS_2;
(or maybe UCS_2LE, I
not know byte ordering of your used unicode
components...)
--
Lukas Gebauer.
E-mail:
[EMAIL PROTECTED]
WEB: http://www.ararat.cz/synapse - Synapse Delphi and Kylix
TCP/IP
Library
-------------------------------------------------------------------------
Take
Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay
panel and you'll get the chance to share your
opinions on IT & business
topics through brief surveys-and earn
cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
synalist-public
mailing
list
[email protected]
https://lists.sourceforge.net/lists/listinfo/synalist-public
hi thank your for a quick reply but still no luck here i tried the following 2 things: htmlPart := Msg2.AddPart(MimePart); HTMLContent := TTntStringList.Create; (unicode support string list) try HTMLContent.Text := tmp; (tmp is widestring) htmlContent.SaveToStream(htmlPart.DecodedLines); htmlPart.Primary := 'text'; htmlPart.Secondary := 'html'; htmlPart.Description := 'HTML text'; htmlPart.Disposition := 'inline'; htmlPart.CharsetCode := UTF_8; htmlPart.EncodingCode := ME_QUOTED_PRINTABLE; htmlpart.TargetCharset := UCS_2 htmlPart.EncodePart; htmlPart.EncodePartHeader; finally HTMLContent.Free; end; the above resulted with what u can see in the attachment
so i tried to do what the same as i did with the text part which worked perfect:
htmlPart := Msg2.AddPart(MimePart);
HTMLContent := TStringList.Create; (not unicode)
try
HTMLContent.Text := WideStringToStringEx(tmp,CP_UTF8); (conversion
that worked perfect in text part)
htmlContent.SaveToStream(htmlPart.DecodedLines);
htmlPart.Primary := 'text';
htmlPart.Secondary := 'html';
htmlPart.Description := 'HTML text';
htmlPart.Disposition := 'inline';
htmlPart.CharsetCode := UTF_8;
htmlPart.EncodingCode := ME_QUOTED_PRINTABLE;
htmlpart.TargetCharset := UCS_2; / UTF_8;
htmlPart.EncodePart;
htmlPart.EncodePartHeader;
finally
HTMLContent.Free;
end;
but for this i got either gibberish or the same as the attached (i tried both
ucs_2 and utf_8)
please advice
______ 10/03/2007 20:02:10, Lukas Gebauer - [EMAIL PROTECTED] ___:
> htmlPart := Msg2.AddPart(MimePart);
> HTMLContent := TTntStringList.Create; (unicode support string
> list) try
> HTMLContent.Text := tmp; (tmp is widestring)
> htmlContent.SaveToStream(htmlPart.DecodedLines);
> htmlPart.Primary := 'text';
> htmlPart.Secondary := 'html';
> htmlPart.Description := 'HTML text';
> htmlPart.Disposition := 'inline';
> htmlPart.CharsetCode := UTF_8;
> htmlPart.EncodingCode := ME_QUOTED_PRINTABLE;
> htmlPart.EncodePart;
> htmlPart.EncodePartHeader;
> finally
> HTMLContent.Free;
> end;
> after EncodePart, the result is 1 character
> and it seems that 1 of the first characters when loading the stream is #0
> which is null so the decoding ends in the beginning what am i missing?
No, you forgot to set charset encoding used in DecodedLines stream.
Synapse asumes system codepage as default, and it is wrong encoding in
your case. It is probably UCS_2. So, set (before EncodePart, of course!):
htmlpart.TargetCharset := UCS_2;
(or maybe UCS_2LE, I not know byte ordering of your used unicode
components...)
--
Lukas Gebauer.
E-mail: [EMAIL PROTECTED]
WEB: http://www.ararat.cz/synapse - Synapse Delphi and Kylix TCP/IP
Library
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
synalist-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/synalist-public<<attachment: unicode.JPG>>
------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________ synalist-public mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/synalist-public
