Skip to content

Commit

Permalink
set LANG to en_US.UTF-8 if not set for R 4.2 windows
Browse files Browse the repository at this point in the history
  • Loading branch information
randy3k committed May 4, 2022
1 parent 1cab858 commit f016d46
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 2 additions & 0 deletions radian/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,8 @@ def run(self, options, cleanup=None):

rchitect.init(args=args, register_signal_handlers=True)

rutils.set_lang()

try:
rutils.source_radian_profile(options.profile)
except RuntimeError as e:
Expand Down
10 changes: 9 additions & 1 deletion radian/rutils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import os
import sys
from rchitect import rcopy, rcall
from rchitect import rcopy, reval, rcall
from rchitect._cffi import ffi, lib
from rchitect.interface import roption, protected, rstring_p
from .key_bindings import map_key
Expand Down Expand Up @@ -89,6 +89,14 @@ def register_cleanup(cleanup):
onexit=True)


def set_lang():
if sys.platform.startswith("win"):
if not os.environ.get("LANG", ""):
if rcopy(reval(
'compareVersion(paste0(R.version$major, ".", R.version$minor), "4.2.0") >= 0')):
os.environ["LANG"] = "en_US.UTF-8"


def run_on_load_hooks():
hooks = roption("radian.on_load_hooks", [])
for hook in hooks:
Expand Down

0 comments on commit f016d46

Please sign in to comment.