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

Windows woes: emojis render inline but not in blocks #7

Selbosh opened this issue May 4, 2017 · 1 comment

Windows woes: emojis render inline but not in blocks #7

Selbosh opened this issue May 4, 2017 · 1 comment


Copy link

@Selbosh Selbosh commented May 4, 2017

I have no doubt that this problem is due to something further upstream but I don't know exactly what. I have tried saving the Rmd file with every possible encoding.

Minimal working example on Windows

Block emojis:

```{r, collapse = TRUE}

And inline: `r emo::ji('poop')`

Returns something that looks like this

Block emojis:

## <f0><U+009F><U+0092><U+00A9>
##                poop 
## "<f0><U+009F><U+0092><U+00A9>"

And inline: 💩

Searching online, the only other report of this issue that I could find, with unicode code points (if that's the correct term) being coerced into angle brackets is here.

I have noticed that the behaviour is different in the console and in knitting Rmd files. If I simply enter the following into the console:


then the output is


but, still in the console,




which looks like the Rmarkdown output, above.

So it looks like for block text output Rmarkdown/Knitr is parsing (multi-byte?) unicode characters differently to inline, with the result that on Windows, emo works inline but not in chunks.

Copy link

@yutannihilation yutannihilation commented May 10, 2017

I guess this should be reported to hadley/evaluate, which is used inside knitr.

evaluate:::evaluate_call(expression(emo::ji('poop')), NULL, globalenv(), baseenv())

[1] "source"

[1] "<f0><U+009F><U+0092><U+00A9> \n"

And the bellow is basically the same as what evaluate:::watchout() does. I doubt textConnection() can handle emojis, since it does some text conversion which makes us unhappy...

output <- character()
con <- textConnection("output", "wr", local = TRUE)
capture.output(print(emo::ji('poop')), file = con)
#> [1] "<f0><U+009F><U+0092><U+00A9> "

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants