cph
cph copied to clipboard
[Bug?] The Python `Received Output` will display Chinese as gibberish when without `Use Unicode UTF-8 for worldwide language support` in windows
Extension Version: v6.1.0
VS Code Version: 1.89.0
Browser Version:
Operating System: Windows 11 x64
Python Version: 3.11.4
Description
Hi, CPH is really an excellent plugin, but it can't work well on my computer in some situations.
I have read the #338 and the problem seems to only happen in Python, I think it's better to open a new issue.
I don't know how to program in TypeScript, but I think we can provide a custom output encoding in the extension settings.
Here is some relevant information, thanks to the patient.
Use Unicode UTF-8 for worldwide language support
Control Panel > Clock and Region > Region > Administrative tab > Change system locale button > Beta:Use Unicode UTF-8 for worldwide language support.
Code
print("你好")
Test without UTF-8
Test with UTF-8
Test with custom TextIOWrapper and without UTF-8
from io import TextIOWrapper
import sys
sys.stdout = TextIOWrapper(sys.stdout.buffer, encoding="utf-8")
print("你好")