Help me understand why Unicode only works sometimes with Python

前端 未结 5 1258
别跟我提以往
别跟我提以往 2020-12-14 22:11

Here\'s a little program:

#!/usr/bin/env python
# -*- encoding: utf-8 -*-

print(\'abcd kΩ ☠ °C √Hz µF ü ☃ ♥\')  
print(u\'abcd kΩ ☠ °C √Hz µF ü ☃ ♥\')
         


        
5条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-14 22:59

    Unicode output from Python to the Windows console just doesn't work. Python can't be persuaded to emit the native Windows encoding which expects wide characters and UCS2.

提交回复
热议问题