【发布时间】:2015-03-03 09:34:02
【问题描述】:
给定以下由sample-template 标识的 Mandrill 电子邮件模板:
Hi *|FIRST_NAME|*,
Here are some international characters: ąćę.
和使用 Mandrill 的 Parse SDK 执行的 sendTemplate 调用:
Mandrill.sendTemplate({
template_name: 'sample-template',
template_content: {},
message: {
subject: 'This e-mail will have some characters missing',
to: [{
email: 'dummy@example.com',
type: 'to',
}],
global_merge_vars: [{
name: 'FIRST_NAME',
content: 'Jędrzej',
}],
},
async: true,
}, {
success: function(httpResponse) {},
error: function(httpResponse) {},
});
将导致以下电子邮件发送给收件人(在电子邮件客户端中查看):
Hi Jdrzej,
Here are some international characters: ąćę.
请注意名称Jędrzej 中的国际字符ę 缺失,在第一行给出Jdrzej。当国际字符直接放在模板中时不会发生这种情况,但前提是它们是通过global_merge_vars 提供的。
对原始消息的检查显示,ąćę 字符在消息正文中正确转义:
Hi Jdrzej,
Here are some international characters: =C4=85=C4=87=C4=99.
根据电子邮件标题:
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
看起来 Mandrill API 只是在将非 ASCII 字符应用到模板之前从合并值中去除它们。
在合并标签中支持国际 (UTF-8) 字符的正确方法是什么?
【问题讨论】: