Issue with locale setting at R startup

228 views
Skip to first unread message

nico....@gmail.com

unread,
Oct 16, 2017, 9:20:38 AM10/16/17
to Nvim-R
Hi,

I run Neovim in combination with the R Gui (R: 3.4.1, Gui: 1.70).

When I launch R through vim, I get the following warning about my locale:

"During startup - Warning messages:
1: Setting LC_CTYPE failed, using "C"
2: Setting LC_COLLATE failed, using "C"
3: Setting LC_TIME failed, using "C"
4: Setting LC_MESSAGES failed, using "C"
5: Setting LC_MONETARY failed, using "C"
[R.app GUI 1.70 (7375) x86_64-apple-darwin15.6.0]

WARNING: You're using a non-UTF8 locale, therefore only ASCII characters will work.
Please read R for Mac OS X FAQ (see Help) section 9 and adjust your system preferences accordingly.
"

This does not happen when I start R GUI outside of Nvim. I have made sure the startup directory contains a .Rprofile file, in which the locale is set according to instructions on the R FAQ (defaults write org.R-project.R force.LANG en_US.UTF-8).

QUESTION: How can I control the startup process of R GUI such that R reads the correct default setting for my locale?

The wrong setting interferes with the installation of some packages.

Thanks!

Jakson Alves de Aquino

unread,
Oct 16, 2017, 10:17:15 AM10/16/17
to Nvim-R
I don't know about Mac OS X, but on Linux, we may set the locale in the ~/.bashrc if bash is the default shell.
If your shell is bash, you could try putting this in your ~/.bashrc (you don't need all lines, perhaps only the LANG one):

export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
export LANGUAGE=en_US.UTF-8
export LC_ADDRESS=en_US.UTF-8
export LC_COLLATE=en_US.UTF-8
export LC_CTYPE=en_US.UTF-8
export LC_IDENTIFICATION=en_US.UTF-8
export LC_MEASUREMENT=en_US.UTF-8
export LC_MESSAGES=en_US.UTF-8
export LC_MONETARY=en_US.UTF-8
export LC_NAME=en_US.UTF-8
export LC_NUMERIC=en_US.UTF-8
export LC_PAPER=en_US.UTF-8
export LC_TELEPHONE=en_US.UTF-8
export LC_TIME=en_US.UTF-8

If the above lines do not work, you could see what is the locale in the R gui before setting it in your ~/.bashrc. Example:

Sys.getenv("LANG")


nico....@gmail.com

unread,
Oct 17, 2017, 5:13:13 AM10/17/17
to Nvim-R
Thanks Jakson!
Unfortunately, that did not help. I created edited the .bashrc as suggested and if I query

> Sys.getenv('LANG')

I get

[1] "en_US.UTF-8"

It looks the same for LC_CTYPE. Yet I still get the warning about the non-UTF locale.


nico....@gmail.com

unread,
Oct 17, 2017, 5:30:56 AM10/17/17
to Nvim-R
the problem appears to be that there is a disconnect between the settings in Terminal and those when I start the R GUI through NVim. The locale in Terminal itself appears to be set correctly:

$ locale
LANG="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_CTYPE="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_ALL="en_US.UTF-8"

Thanks for further input.

Jakson Alves de Aquino

unread,
Oct 17, 2017, 6:54:17 AM10/17/17
to Nvim-R
I'm sorry, but I don't have access to any Mac OS X. Perhaps you could find a solution searching the web for terms like: Mac OS X environment variable gui application
Reply all
Reply to author
Forward
0 new messages