use Encode; use Win32::GuiTest qw(FindWindowLike); $line="***Winow title in chinese**"; binmode(STDOUT, ":utf8"); print "$line\n"; #===> Here perl prints out some chinese text to the command console, but different from what is given in input file my @hwnd=Win32::GuiTest::FindWindowLike(undef,$line); if($hwnd[0]) { print "window found\n"; } else { print "window not found\n"; }