Unicode is like a conceptual text idea that is only present in your program.
This has the advantage that it can support any character, but a flaw that it cannot output as is, and therefore needs to be encoded into some encoding that can be displayed.
So, you need some input, it will be encoded, and you have to decode it, and if you want to output unicode, you need to code it.
If you do not, python will try to do it for you (using ASCII or something that can be found in your env, as in your case), but you should not rely on it because python may make a mistake (as in your case )
Pretty funny, you may notice that in your case your terminal supports utf8, but this python did not understand that it could use utf8.
This is why you should always encode output and decode input (preferably using utf8 whenever possible!)
You can achieve this by using the unicode encoding method and the string decoding method by providing them with the encoding as an argument.
source share