Printing unicode | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Printing unicode

hey is there any way to print Unicode characters into command prompt? when I try to print Unicode character it says 'charmap' codec can't encode characters in position 0-1: character maps to <undefined> however it prints OK in python IDLE

12th Nov 2016, 8:18 AM
Sunera Avinash
Sunera Avinash - avatar
4 Answers
+ 1
yeah it was the first thing I did but it did not work
12th Nov 2016, 2:02 PM
Sunera Avinash
Sunera Avinash - avatar
+ 1
it doesn't work either :( I'm beginning to think that it can't be done because command prompt can't accept some Unicode characters or something
12th Nov 2016, 7:20 PM
Sunera Avinash
Sunera Avinash - avatar
0
try to start your program with this comment # -*- coding: utf -8 -*-
12th Nov 2016, 12:11 PM
Niklar
Niklar - avatar
0
you can also use: print(str(yourstringvariable).encode('utf-8'))
12th Nov 2016, 5:47 PM
Cristi Vlad
Cristi Vlad - avatar