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

Encoding of retrieved messages #86

SimonCoulombe opened this issue Nov 7, 2017 · 2 comments

Encoding of retrieved messages #86

SimonCoulombe opened this issue Nov 7, 2017 · 2 comments


Copy link

@SimonCoulombe SimonCoulombe commented Nov 7, 2017

Hi Jim,

I am trying to retrieve messages and run some regexp on the content. I am retrieving the body of my message as follow:

my_message = message(id = "myid", format="full")

The issue I have is that all the French characters are broken and replaced by funky symbols. Where can I set the encoding to fix this?

Fantastic package, thanks for it.

Copy link

@SimonCoulombe SimonCoulombe commented Nov 8, 2017

This works for me:

my_base64url_decode_to_char <- function(x) { iconv(rawToChar(base64decode(gsub("_", "/", gsub("-", "+", x)))), from="UTF-8", to="latin1") }

unlockBinding("base64url_decode_to_char", getNamespace("gmailr"))
assign("base64url_decode_to_char", my_base64url_decode_to_char, getNamespace("gmailr"))

edit: this worked once. I have output to prove it... but now it doesnt.
When I run body() I now get the following error
Error in base64decode(gsub("_", "/", gsub("-", "+", x))) :
could not find function "base64decode"

edit 2: adding "base64enc::" fixes it.

my_base64url_decode_to_char <- function(x) { iconv(rawToChar(base64enc::base64decode(gsub("_", "/", gsub("-", "+", x)))), from="UTF-8", to="latin1") }


Copy link

@jimhester jimhester commented Aug 15, 2019

@SimonCoulombe if you are still running into this problem could you provide an example email object that shows the issue as an .Rds, using saveRDS(msg, "out.Rds").


@jimhester jimhester closed this in d4010e9 Aug 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants