-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for Windows UTF-8 version of R #269
Comments
These are the relevant lines for decoding and encoding: https://github.com/randy3k/rchitect/blob/cb6e77c860ef180bd7f47416c94185fb9db04370/rchitect/utils.py#L142
|
https://www.r-project.org/nosvn/winutf8/ucrt3/ I just found that running |
|
randy3k/rchitect@7c0d72a should fix the garbled text issue. However, it requires checking the beta UTF-8 setting in Region settings. |
There is some discussion on enabling UTF-8 codepage on Windows, but it won't happen soon. So for now, the unicode setting in regional settings is the only way to enable UTF-8 on radian. |
In my opinion this issue occurs when radian calls R, system tends to use system-wide encoding settings instead of one set in the console, making R think that the current codepage is not UTF-8. |
We have to wait until python supports Unicode codepage on Windows. See https://groups.google.com/g/python-ideas/c/iPgyhq3_zyI/m/uGXrunPWAQAJ |
UTF-8 has become the default encoding now. 🤔 |
I guess we'd need to force utf8 encoding for newer version of R. |
Hi @SpecterShell, would it work if you set the variable |
Then the solution for us is simpler, we could just set it if it is unset. |
@SpecterShell |
Great, radian 0.6.2 is on the way. |
Where is the |
|
Hi @SpecterShell, there was no Yet I have found 2 things quite smiliar to
Is it possible to configure any of these to make the UTF-8 global setting? Thanks! |
You can create one if it doesn't exist. |
OK, thanks! |
I think perhaps the best solution for this is adding |
After set the local by There were 15 warnings (use warnings() to see them)
r$> warnings()
Warning messages:
1: In Sys.setlocale("LC_CTYPE", ctype) :
using locale code page other than 936 may cause problems |
Not sure if I'm in the right place here, but R.4.2 + radian seems to be entirely non-functional in my case. No changing of env vars seems to change that. Radian fails on start: System setup
Stack trace
EDIT: The culprit is here: radian/radian/lineedit/history.py Line 67 in adbf612
Trying to load |
Good catch, we should make sure that the history file is in utf-8. |
where is the history file? I meet the same |
An experimental build of R using UTF-8 as native encoding on Windows has been released recently, and here is the instruction: https://svn.r-project.org/R-dev-web/trunk/WindowsBuilds/winutf8/ucrt3/howto.html
I'm on Windows 10 20H2 and has set
$LANG
tozh_CN.UTF-8
. After setting the codepage to 65001(UTF-8), the encoding in Rterm successfully switches to UTF-8, but the encoding in radian remains unchanged.In most of the time the terminal and the graph can still handle CJK characters properly. But sometimes some messy codes show, like the red text in the screenshot.
I thought this issue came from Python itself, so I set
$PYTHONUTF8
to1
to force Python to use UTF-8, and ranpython -m radian
instead ofradian
. However it doesn't work for radian. I also tried to directly change the encoding in radian, and then it crashed.The text was updated successfully, but these errors were encountered: