skip to Main Content

I am experiencing a problem when trying to print chinese characters in VSCODE using python. the characters are not coming correctly. Please see the output. Please help.

My encoding is selected as UTF-8 already. Python version : 3.12 VS
code version : 1.92.1 OS : Windows NTX64 10.0.19045

data = "中國哲學書電子化計劃"
print(data)

Output : ������Ǯѹq�l�ƭp��

enter image description here

2

Answers


  1. What’s about your terminal(system) encoding?

    enter image description here

    This mean your .py file in utf encoding.

    Try terminal command

    chcp 65001
    

    Also check this: How can I use Unicode characters on the Windows command line?

    Login or Signup to reply.
  2. You can activate UTF-8 for worldwide language support in Control Panel-Languages and Region:

    Inbasu’s answer chcp 65001 would do the trick aswell.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search