I have a Chinese program in python 2.7 that is giving me some problems
Code:
# -*- coding: gb2312 -*-
import sys
command = raw_input(">>> ").decode(sys.stdin.encoding)
if (command == u"你好".encode('utf-8')):
print "etc"
I get the error:
test_chinese.py:6: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal if (command == u"����".encode('utf-8')):
Is there anything incorrect?
if (command == u"你好"):instead ofif (command == u"你好".encode('utf-8')):