Emojis confuse text editor


#1

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.


#2

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.


#3

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


#4

We do have an issue tracking this here: https://github.com/rstudio/rstudio/issues/1701

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

01%20PM

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