fix : AttributeError in Python3

fix : run python weixin.py then AttributeError: 'str' object has no attribute 'decode'
This commit is contained in:
omg2hei
2017-03-30 17:15:51 +08:00
committed by GitHub
parent 3c019b1f96
commit 2ed4cff3fa
+1 -1
View File
@@ -1161,7 +1161,7 @@ class UnicodeStreamFilter:
def write(self, s): def write(self, s):
if type(s) == str: if type(s) == str:
s = s.decode('utf-8') s = s.encode().decode('utf-8')
s = s.encode(self.encode_to, self.errors).decode(self.encode_to) s = s.encode(self.encode_to, self.errors).decode(self.encode_to)
self.target.write(s) self.target.write(s)