Currently we are using SendGrid Inbound Parse to receive emails. We handle the Inbound Parse webhook request by Azure HttpTrigger function implmented in C# (.NET 6). When the received email is in UTF-8 encoding, everything's okay. However, when we tried to receive email in shift_jis encoding, headers are okay, but japanese characters in text and html are garbled.
From Inbound Parse request, we got the charsets as below:
And the string we got directly from request.form["text"] (or "html") was already garbled like "�e�L�X�gshiftJis-007" (should be "テキストshiftJis-007"), so we cannot use string in request directly.
Then we tried to convert (System.Text.Encoding.Convert method) it from charset encoding (shift_jis) to utf-8, and the result was different from original string but still unreadable "?e?L?X?gshiftJis-007".
Our questions are: When using C# HttpTrigger Azure function to handle Inbound Parse webhook request (request data is passed through AspNetCore.)
Twilio Developer Evangelist here. I would recommend reaching out to the support team because it requires to investigate the payload to figure out what is going on.
I also tried to replicate the issue on my end with using send_raw option. Here's the payload, and it does contain shift_jis characters. You may be able to process the payload manually.
(stripped X-Mailer info)
'Content-Type: text/plain; charset="shift_jis"\n' +
'X-Mailer: \n' +
'Content-Transfer-Encoding: quoted-printable\n' +
'\n' +
'\n' +
'=83e=83L=83X=83gshiftJis-007\n'