fix non utf-8 input support