You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While this itself is a very great change, this causes a possible mismatch between the system's encoding and R's encoding. Currently, the default of format argument is 1, which means (from ?clipboard):
CF_TEXT 1 Text in the machine's locale
but R uses UTF-8. Because of this gap, the texts will get garbled like this: tidyverse/reprex#406
To avoid the problem, we need to specify 13, which means unicode (UTF-16).
CF_UNICODETEXT 13 Text in Unicode (UCS-2)
By choosing this, the R's connection API will converts the text from / to R strings properly (I don't understand the mechanism, but it seems to work so. c.f., https://bugs.r-project.org/show_bug.cgi?id=18267). Actually, this is the recommended setting by ?clipboard:
It is recommended to use Unicode text instead of text to avoid interoperability problems. (Note that R 4.2 and newer on recent systems uses UTF-8 as the native encoding but the machine's locale uses a different encoding.)
The text was updated successfully, but these errors were encountered:
You know, the upcoming R 4.2 for Windows will support UTF-8 as native encoding.
c.f. https://blog.r-project.org/2021/12/07/upcoming-changes-in-r-4.2-on-windows/index.html
While this itself is a very great change, this causes a possible mismatch between the system's encoding and R's encoding. Currently, the default of
format
argument is1
, which means (from?clipboard
):but R uses UTF-8. Because of this gap, the texts will get garbled like this: tidyverse/reprex#406
To avoid the problem, we need to specify
13
, which means unicode (UTF-16).By choosing this, the R's connection API will converts the text from / to R strings properly (I don't understand the mechanism, but it seems to work so. c.f., https://bugs.r-project.org/show_bug.cgi?id=18267). Actually, this is the recommended setting by
?clipboard
:The text was updated successfully, but these errors were encountered: