fix focus problem and utf-8 decoding problem