Skip to content
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

Cannot type the "±" symbol in Radian on Windows platforms. #360

Closed
yanpd01 opened this issue May 11, 2022 · 7 comments
Closed

Cannot type the "±" symbol in Radian on Windows platforms. #360

yanpd01 opened this issue May 11, 2022 · 7 comments

Comments

@yanpd01
Copy link

yanpd01 commented May 11, 2022

operating environment

radian version: 0.6.2
r executable: C:\R\R-4.2.0\bin\R
r version: 4.2.0
python executable: C:\Users\cuilab\AppData\Local\Programs\Python\Python310\python.exe
python version: 3.10.4
windows 10 21H2: 19044.1645
system language: Chinese (People's Republic of China)

problem description

Whether running radian in CMD or Powershell, or directly opening radian.exe, I cannot type "±". Even the URLdecode("%C2%B1") function doesn't print "±" correctly, but everything looks fine in Linux.

screenshots

001

@randy3k
Copy link
Owner

randy3k commented May 11, 2022

what does Sys.getenv("LANG") return?

@yanpd01
Copy link
Author

yanpd01 commented May 11, 2022

what does Sys.getenv("LANG") return?

Enter Sys.getenv("LANG"), it will be displayed as "en_US.UTF-8" in radian and "" in the R console. When I set Sys.setenv(LANG="") in radian, I still can't type and print ±. But everything works fine in the R console.

@randy3k
Copy link
Owner

randy3k commented May 11, 2022

The workaround of setting LANG was inspired by #269 (comment)

@SpecterShell
Could you reproduce the same bug here?

@SpecterShell
Copy link

SpecterShell commented May 12, 2022

The same here, but may not relate to that change. 🧐

While %C2%B1 maps to ± in UTF-8, it maps to in GB2312.

Default GB2312 (936) in console, GB2312 (936) in radian
image

Set UTF8 (65001) in console, GB2312 (936) in radian
image

Default GB2312 encoding (936) in console, UTF-8 (65001) in R
image

@yanpd01
Copy link
Author

yanpd01 commented May 12, 2022

When I run Sys.setlocale(locale ="Chinese (Simplified)_China.UTF-8"), I can type and print "±" normally. But running this code throws a warning, will this affect other operations?

002

@randy3k
Copy link
Owner

randy3k commented May 12, 2022

Indeed, it is a locale related stuff. Python on Windows doesn't support UTF-8 as default codepage, so it inherits the system locale, which is simplified chinese in your case.

I think it should be safe to ignore the warning in this case as R 4.2 indeed does support UTF-8 codepage.

@yanpd01
Copy link
Author

yanpd01 commented May 12, 2022

I am going to write Sys.setlocale(locale ="Chinese (Simplified)_China.UTF-8") into the .Rprofile file, in order to use the radian better.
Thanks for your answer.

@yanpd01 yanpd01 closed this as completed May 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants