Skip to content

Python Native REPL cannot handle some unicode #24481

@YongHee-Kim

Description

@YongHee-Kim

Behaviour

Native REPL cannot handle some unicode string properly

Steps to reproduce:

When you include korean letters in a string variables, most of letters throws UnicodeEncodeError: 'utf-8' codec can't encode error from the Python Native REPL. However, they works on the terminal

# Throws UnicodeEncodeError
a = "소문자"
b = "こんにちは"

# Doesn't throw error 
c = "안녕하세요"

Image
Image

Diagnostic data

Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

Traceback (most recent call last):
  File "c:\Users\ykim\.vscode\extensions\ms-python.python-2024.20.0-win32-x64\python_files\python_server.py", line 129, in exec_user_input
    callable_ = exec_function(user_input)
  File "c:\Users\ykim\.vscode\extensions\ms-python.python-2024.20.0-win32-x64\python_files\python_server.py", line 94, in exec_function
    compile(user_input, "<stdin>", "eval")
    ~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'utf-8' codec can't encode character '\udc90' in position 13: surrogates not allowed

Metadata

Metadata

Assignees

No one assigned

    Labels

    triage-neededNeeds assignment to the proper sub-team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions