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

Python cp949 encoding error #8549

Closed
3 of 4 tasks
issactoast opened this issue Dec 7, 2020 · 6 comments
Closed
3 of 4 tasks

Python cp949 encoding error #8549

issactoast opened this issue Dec 7, 2020 · 6 comments

Comments

@issactoast
Copy link

System details

RStudio Edition : <!-- Desktop or Server -->
RStudio Version : 1.4.1056
OS Version      : Windows10
R Version       : 4.0.3 (2020-10-10)

Steps to reproduce the problem

print korean letters in Rstudio python py file and run
print("안녕")

Describe the problem in detail

If I run the print Korean word using the print function, it shows the following error.

reticulate::repl_python()
Python 3.8.3 (C:/Users/issac/miniconda3/python.exe)
Reticulate 1.18 REPL -- A Python interpreter in R.
>>> print("안녕")
UnicodeEncodeError: 'cp949' codec can't encode character '\xc8' in position 1: illegal multibyte sequence

I check out the same code in miniconda python, it shows Korean 안녕 correctly.

Describe the behavior you expected

print Korean word in console "안녕"

  • I have read the guide for submitting good bug reports.
  • I have installed the latest version of RStudio, and confirmed that the issue still persists.
  • If I am reporting a RStudio crash, I have included a diagnostics report.
  • I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
@melissa-barca
Copy link
Contributor

Thank you for reporting this issue. I can reproduce in 1.4.1081 on Windows.
@kevinushey do you think this is something we can get into 1.4?

@kevinushey
Copy link
Contributor

I don't think this quite meets the bar for 1.4 since we're so close to release, but let's definitely fix for 1.4-JR.

@astayleraz
Copy link
Contributor

astayleraz commented Jan 25, 2021

I tested this in desktop Version 1.4.1514 and get the following error still

> reticulate::repl_python()
Python 3.6.12 (C:/Users/IEUser/AppData/Local/r-miniconda/envs/r-reticulate/python.exe)
Reticulate 1.18.9005 REPL -- A Python interpreter in R.
>>> print("안녕")
UnicodeEncodeError: 'charmap' codec can't encode characters in position 0-1: character maps to <undefined>
>>> print("你好")
UnicodeEncodeError: 'charmap' codec can't encode characters in position 0-1: character maps to <undefined>

@kevinushey kevinushey self-assigned this Jan 25, 2021
@kevinushey
Copy link
Contributor

Thanks for catching this @astayleraz: this was my fault; I have my Windows VM configured with the environment variable:

PYTHONIOENCODING = utf-8

and that is also required for this fix to be fully "done". I think this should be the default, so I'm going to update reticulate to make that happen.

@kevinushey
Copy link
Contributor

Should now be fixed in the development version of reticulate, via rstudio/reticulate@6213b15.

@astayleraz: please re-install the development version of reticulate with remotes::install_github("rstudio/reticulate"), and then run the test again; hopefully all should be well now!

@issactoast
Copy link
Author

issactoast commented Feb 1, 2021

@kevinushey @astayleraz I have tested this also in RStudio version 1.4.1533 with the latest reticulate! works perfectly! thanks!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants