Hi!
I had troubles with working on non-latin characters for my email header (gmail api). I implemented something like this to help with the conversion:
var subj = startTrigger.data.subject.split(/([^\x00-\x7F]+)/)
var res = []
function rfc2047(str) {
const base64 = btoa(unescape(encodeURIComponent(str)));
return `=?utf-8?B?${base64}?=`
}
subj.forEach((x) => {
if(/[^\x00-\x7F]/.test(x)) {
res.push(rfc2047(x))
} else {
res.push(x)
}
})
return res.join(' ')
I was wondering though how others perform this as I can't simply pass on the subject as is from a webhook payload trigger. I might be overdoing it and there might be an easier way of doing this.