I created the SES template and rendered it from the aws-cli, as you can see the non-English texts are replaced by '?', both in plain text version and HTML version. How to fix this? P.S: I also checked it by sending an email.
the following is my TestMainTemplate.json file
{
"Template": {
"TemplateName": "TestTemplate01",
"SubjectPart": "こんにちは {{name}}!",
"HtmlPart": "<h1>こんにちは {{name}}さん</h1><p>あなたの好きなAWSサービスは{{favoriteservice}}ですね。</p>",
"TextPart": "前略 {{name}}さん\r\nあなたの好きなAWSサービスは{{favoriteservice}}ですね。\r\n草々"
}
}
comamnd to upload template to aws SES from cli :
aws ses create-template --cli-input-json file://TestMainTemplate.json --region us-east-1
command to render the template:
aws ses test-render-template --template-name TestTemplate01 --template-data '{ "name": "大栗" , "favoriteservice": "SES" }' --region us-east-1
output:
Date: 2018-09-14T03:27:46.913Z
Message-ID: <5990...........ec2-user@ip-......ec2.internal>
Subject: ????? ??!
MIME-Version: 1.0
Content-Type: multipart/alternative;
boundary="----=_Part_106793_202759574.1536895666913"
Content-Transfer-Encoding: quoted-printable
------=_Part_106793_202759574.1536895666913
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
?? ????
???????AWS?????SES????
??
------=_Part_106793_202759574.1536895666913
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 7bit
<h1>????? ????</h1><p>???????AWS?????SES????</p>
------=_Part_106793_202759574.1536895666913--
I suspect your terminal isn't set to UTF-8. What does echo $LANG
say? In my case it's:
$ echo $LANG
en_NZ.UTF-8
I tried the steps above and got back a valid rendered base64-encoded text:
$ aws --output text ses test-render-template --template-name TestTemplate01 --template-data '{ "name": "大栗" , "favoriteservice": "SES" }' --region us-east-1
Date: 2018-09-15T23:36:13.701Z
Message-ID: <143...>
Subject: =?UTF-8?B?44GT44KT44Gr44Gh44GvIOWkp+aglyE=?=
MIME-Version: 1.0
Content-Type: multipart/alternative;
boundary="----=_Part_237228_701472298.1537054573701"
Content-Transfer-Encoding: quoted-printable
------=_Part_237228_701472298.1537054573701
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: base64
5YmN55WlIOWkp+agl+OBleOCkw0K44GC44Gq44Gf44Gu5aW944GN44GqQVdT44K144O844OT44K5
44GvU0VT44Gn44GZ44Gt44CCDQrojYnjgIU=
------=_Part_237228_701472298.1537054573701
[... etc ...]
Also what's your aws-cli version?
$ aws --version
aws-cli/1.14.14 Python/2.7.12 Linux/4.15.0-34-generic botocore/1.8.18
Apparently mine is fairly old (current is 1.16.14) and the SES command still works as expected.
I'm quite confident that it's a problem with your terminal encoding. It must be set to UTF-8 for this to work.