Let's consider the following code:
> cat('\u2077\u2078\u2079 \u2087\u2088\u2089')
⁷⁸⁹ ₇₈₉
> out <- file("out.txt", "w", encoding = 'utf-8')
> cat('\u2077\u2078\u2079 \u2087\u2088\u2089', file=out)
> close(out)
the content of out.txt
is:
78<U+2079> 789
The sub/superscript form is lost and for exponent 9 it's the codepoint that is printed.
What's happening here? How can I have the correct form of the characters in the file as they are printed in the RStudio console?
Versions: RStudio 1.1.436 / R 3.5.2 / Windows 10