Tag Archives: python sublime3 [Decode error – output not utf-8]

Python sublime3 [Decode error – output not utf-8] Chinese display problem

Generally speaking, this is a coding problem

The problem can be solved by sacrificing big killers

# coding: utf-8
import sys
reload(sys)
sys.setdefaultencoding("utf-8")
print '你好'
>>>你好

But today we are talking about another problem

Running in sublime is [decode error – output not UTF-8]

There is no problem running under CMD

The code is as follows

# coding: utf-8
import sys
reload(sys)
sys.setdefaultencoding("utf-8")

print "GOOD-成功"

cmdDown

Delete

#The coding is fine, it's a bug in sublime
#Change it to print "GOOD-success-GOOD" and it will be fine
#The solution is to put a space at the end

print "GOOD-Success"
#Tested several positions and they all work
print "success-GOOD"
print "success-GOOD-success"
#Summarize that you can't start with Chinese and end with Chinese