use encode('utf8') to encode Chinese chars, and use isalpha() to tell whether input text is Roman letters or not, to decide which column of db to search in. Previous design would search in both column which is not efficient when db grows bigger.