r-lib / gmailr

Access the Gmail RESTful API from R.
https://gmailr.r-lib.org
Other
229 stars 56 forks source link

Smartquotes cause error in encoding as quoted printable #77

Closed jimhester closed 5 years ago

jimhester commented 7 years ago
quoted_printable_encode("\u2018")
#> Error in vapply(x, function(xx) fun(xx), character(1)) :
#>  values must be length 1,
#> but FUN(X[[1]]) result is length 3
zachmaurer commented 7 years ago

For what it's worth, I also got a similar error when sending content that used the character "ç".

quoted_printable_encode("ç")
# Error in vapply(x, function(xx) fun(xx), character(1)) : 
#  values must be length 1,
# but FUN(X[[1]]) result is length 2

Also, just wanted to say, I love gmailr -- a really great package. Thank you so much!

jimhester commented 7 years ago

One easy way to convert these characters is is convert them to ascii equivalents with stringi::stri_trans_general(x, "Latin-ASCII")