问题
I have a python program that generates a string in Tamil language. For example, the string could be தமிழ் . I could write this exactly as it appears here to a text file by using utf-8 at the time of opening the file. But when I write the same string variable to stdout using print() function it displays 3 what(?) characters surrounded by boxes. I have seen printing of literals like print(b'\xc2\xb5'.decode()) and print (u'\u0420\u043e\u0441\u0441\u0438\u044f') happening properly. But the issue arises when I try to print to stdout a text string variable like this. How can I solve this problem? My platform is Windows 10.
回答1:
- Go to
Region & Language Settings
via the Search Bar and add the Tamil language. Below I have added Chinese as an example because I am studying it:
- Open a terminal and make sure your language is selected in the language bar:
- Open the "Command Prompt" properties and make sure to select one of the new fonts that should appear to support your language.
- Type something in the language to test it:
来源:https://stackoverflow.com/questions/63867433/how-to-print-a-variable-having-non-english-characters-to-the-command-prompt-usin