No UTF-8 / Polish characters in R console

Viewed 4857

The Polish characters are not appearing properly in the R console.

> a <- "Wrocław"
> a
[1] "Wroclaw"

This is with the following default locale settings:

> Sys.getlocale()
[1] "LC_COLLATE=English_United States.1252;LC_CTYPE=English_United States.1252;LC_MONETARY=English_United States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252"

After running this:

Sys.setlocale("LC_ALL", "Polish")

I get this:

> a <- "Wrocław"
> a
[1] "Wroc³aw"

Apparently, something is wrong with my locale setup. How do I fix it?

My environment: R: 3.4.0 / Rstudio: 1.0.143 / OS: Windows 10

2 Answers

This might have gotten fixed in RStudio 1.1 (released just a few days ago). See the related comment and associated thread at https://github.com/patperry/r-corpus/issues/5#issuecomment-335401743

Reportedly, this isn't an issue in RStudio 1.1. I haven't tested it myself.

On earlier versions, RStudio would not display native strings correctly when LC_CTYPE did not match the native locale (Sys.setlocale("LC_CTYPE", "")).

Related