Delphi:CDO.Message编码问题
我们编写了一个 Delphi 程序,用 CDO 发送一些信息。
在我的 Win7 机器(匈牙利语)中,重音工作正常。
因此,如果我发送一封带有“ÁÉÍÓÖŐÚÜŰ”的邮件,我就会收到这种格式的邮件。 我在正文中使用了 iso-8859-2 编码,这对主题和电子邮件地址进行了编码(发件人地址包含姓名)。
我以为我就这样结束了。
但是当我尝试从 Win2k3 英文机器发送邮件时(邮件服务器是相同的!),结果是截断一些重音: Ű = U Ő = O
接下来我尝试在这里使用UTF-8编码。
这提供了口音——但口音是错误的。
邮件包含带有 ^ 符号的重音符号。
ê <> é
这不是有效的匈牙利字母... :-(
所以我想知道,如何转换或设置输入以获得良好的结果。
我尝试记录正文以查看更改...
Log(SBody);
Msg.Body := SBody;
Log(Msg.Body);
... 或但
这些日志提供了良好的结果,
因此在 CDO 生成消息时可能会丢失和错误转换,
如果我可以将 ANSI 文本编码为真正的 UTF。 但在 Delphi 转换器函数中没有“CodePage”参数。 在Python中我可以说:
s.encode('iso-8859-2')
或者
s.decode('iso-8859-2')
但是在Delphi中我没有看到这个参数。
有谁知道如何保留重音,如何转换带重音的匈牙利字符串以保留它们的重音格式?
我想知道,不发邮件可以查结果吗?
感谢您的帮助: DD
We wrote a Delphi program that send some informations with CDO.
In my Win7 machine (hungarian) the accents are working fine.
So if I sent a mail with "ÁÉÍÓÖŐÚÜŰ", I got it in this format.
I used iso-8859-2 encoding in the body, and this encode the subject, and the email addresses to (the sender address is contains name).
I thought that I finished with this.
But when I try to send a mail from a Win2k3 english machine (the mailing server is same!), the result is truncate some accents:
Ű = U
Ő = O
Next I tried to use UTF-8 encoding here.
This provided accents - but wrong accents.
The mail contains accents with ^ signs.
ê <> é
This is not valid hungarian letter... :-(
So I want to know, how to I convert or setup the input to I got good result.
I tried to log the body to see is changes...
Log(SBody);
Msg.Body := SBody;
Log(Msg.Body);
... or not.
But these logs are providing good result, the input is good.
So it is possible lost and misconverted on CDO generate the message.
May I can help the CDO if I can encode the ANSI text into real UTF.
But in Delphi converter functions don't have "CodePage" parameters.
In Python I can said:
s.encode('iso-8859-2')
or
s.decode('iso-8859-2')
But in Delphi I don't see this parameter.
Is anybody knows, how to preserve the accents, how to convert the accented hungarian strings to preserve them accented format?
And I want to know, can I check the result without sending the mail?
Thanks for your help:
dd
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
通过 Google 快速搜索“delphi string codepage”,我找到了 terry 的 delphi 页面
也许还有以下代码片段(在此处)可以阐明您的问题:
--reinhard
a quick google search with "delphi string codepage" got me to torry's delphi pages
and maybe the following codesnippets (found here) can shed some light on your problem:
--reinhard