fixing UnicodeEncodeError when searching, close #11941