Hi
I have a unciode file with some chinese text having the titles of some winodws which i have to search for. When i read the file for window title, perl is getting unicode data different from input file
Below 2 snippets explains my problem
Script 1:
use Encode;
use Win32::GuiTest qw(FindWindowLike);
open(MYFILE, '<:encoding(UTF-8)',"saml.txt") || die "cannot open: $!"
+;
open(OUTFILE,'>:encoding(UTF-8)',"out.txt") || die "cannot open: $!";
$WindowTitle=<MYFILE>; #reading the chinese window title from input f
+ile
chomp($WindowTitle);
binmode(STDOUT, ":utf8");
print "$WindowTitle\n"; #===> Here perl prints out some chinese text
+to the command console, but different from what is given in input fil
+e
my @hwnd=Win32::GuiTest::FindWindowLike(undef,$WindowTitle);
if($hwnd[0])
{
print "window found\n";
}
else
{
print "window not found\n";
}
print OUTFILE $WindowTitle; #==> Here perl prints out same chinese te
+xt as input to the outfile
Script 2
use Encode;
use Win32::GuiTest qw(FindWindowLike);
$WindowTitle="V VM"; #Hardcoded the window title in chinese
binmode(STDOUT, ":utf8");
print "$WindowTitle\n"; #===> Here perl prints out some chinese text
+to the command console, but different from what is given in input fil
+e
my @hwnd=Win32::GuiTest::FindWindowLike(undef,$WindowTitle);
if($hwnd[0])
{
print "window found\n";
}
else
{
print "window not found\n";
}
Script 1 reads the chinese window title from unicode file and says that window is not present though window is actually present. Script 2 has chinese window title hardcoded, hence it is giving proper output as window present.
What am i doing wrong while trying to read the unicode file.
Please help