From 5c9de2c1310428f2cad1d71f89af59e45186fc5a Mon Sep 17 00:00:00 2001 From: shrektan Date: Fri, 4 Dec 2020 02:28:45 +0800 Subject: [PATCH] convert to UTF-8 before base64 encode --- R/mime.R | 1 + 1 file changed, 1 insertion(+) diff --git a/R/mime.R b/R/mime.R index 04bbf456..4405198c 100644 --- a/R/mime.R +++ b/R/mime.R @@ -415,6 +415,7 @@ header_unstructured <- function(str, fieldname, encode_unicode = FALSE) { if (grepl("[^\x01-\x7F]", str)) { if (encode_unicode) { + str <- enc2utf8(str) str <- sprintf("=?utf-8?B?%s?=", base64enc::base64encode(charToRaw(str)), 0) } else { warning("The '", fieldname, "' field contains impermissible characters, ",