Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect encoding with Subject part of a mail #76

Closed
grepinsight opened this issue Feb 1, 2017 · 2 comments
Closed

Incorrect encoding with Subject part of a mail #76

grepinsight opened this issue Feb 1, 2017 · 2 comments
Labels
bug an unexpected problem or unintended behavior

Comments

@grepinsight
Copy link

I am trying to send a email with Korean text in the Subject. It doesn't get encoded correctly, even thought it does in body:

Here's a minimal reproducible sample.

use_secret_file("my_gmailr.json")
mail_title <- "[test]  안녕"
test_email <- mime(
  To = "myemailgmail.com",
  From = "myemailgmail.com",
  Subject = mail_title,
  body = " 
contents. 한국어
  ")
send_message(test_email)
# In gmail
Subject: [test] 안녕      # somehow encoding/decoding get's messed up
Body: contents. 한국어  # renders it fine

Here's my sessionInfo

> sessionInfo()
R version 3.3.1 (2016-06-21)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] gmailr_0.7.1

loaded via a namespace (and not attached):
 [1] httr_1.2.1      magrittr_1.5    R6_2.1.2        tools_3.3.1     base64enc_0.1-3 curl_0.9.7     
 [7] crayon_1.3.2    stringi_1.1.1   jsonlite_1.2    openssl_0.9.4  
@grepinsight
Copy link
Author

I also tested it on my mac as well, to no avail :(

> sessionInfo()
R version 3.2.4 (2016-03-10)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X 10.12.2 (unknown)


locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8


attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     


other attached packages:
[1] gmailr_0.7.1


loaded via a namespace (and not attached):
 [1] httr_1.1.0      magrittr_1.5    R6_2.1.2        tools_3.2.4     base64enc_0.1-3 curl_0.9.7     
 [7] crayon_1.3.2    Rcpp_0.12.7     jsonlite_0.9.19 httpuv_1.3.3    openssl_0.9.2  

@krlmlr
Copy link
Member

krlmlr commented Apr 29, 2017

You could use RFC 1342 (thanks to https://ncona.com/2011/06/using-utf-8-characters-on-an-e-mail-subject/):

mime(..., Subject = paste0("=?utf-8?B?", base64enc::base64encode(charToRaw(enc2utf8("안녕"))), "?=")

@jimhester jimhester added the bug an unexpected problem or unintended behavior label Aug 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug an unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

3 participants