Emojis confuse text editor

I was editing a xaringan slide deck using the most recent preview version 1.2.792 on Ubuntu 18.04. The slide deck containes the following emojis: :construction:, :triangular_ruler:, :cry:, :thinking:, :sweat:, :thinking:, :exploding_head:, :grinning:, and perhaps others. I observed the following behavior:

  • Saving the .Rmd file often garbled it. I could not isolate a pattern, it looks like parts of the text were skipped or repeated. I'm pretty sure that it's the editor that breaks the file, because the .Rmd is version-controlled, and I observed the garbled contents right after saving.

  • When positioning the caret left to any of these emojis and pressing "Cursor right", the caret ended up in the middle of the emoji. Pressing "space" created two three characters -- a space surrounded by two question-mark-like symbols. Pressing "Cursor right" again, instead of space, positioned the caret on the right of the emoji.

Please advise.

1 Like

Not a solution, but a workaround:
I find that typing emojis directly into the IDE inevitably leads to trouble โ€” even in spots far from the emoji input. As a result, I use r emo::ji() (with backticks around it) in my text when I need them.

1 Like

Thanks. Unfortunately this also occurs sometimes with regular umlauts. Is there already an issue for this in the repo?

We do have an issue tracking this here: Source editor display issue when Emoji is present in file. ยท Issue #1701 ยท rstudio/rstudio ยท GitHub

In general, RStudio has trouble with characters that are represented by multiple UTF-16 code points; e.g.


The situation should hopefully get a bit better when we next upgrade Ace, but we haven't yet slotted time for this.

1 Like