I use quotemeta to escape for file path of Chinese filename. But it returns wrong.
Example of the code:
#!/usr/bin/perl
use Encode;
my $ustring1 = "/opt/游戏美术.txt";
my $ustring2 = quotemeta $ustring1;
print "$ustring1\n" ;
print "$ustring2";
print "\n";
Please help to explain and provide the code to solve this. I'm using Perl v5.10.1 Thanks a lot.
Update question:
#!/usr/bin/perl
use Encode;
use utf8;
use open ':std', ':encoding(UTF-8)';
my $ustring1 = "游戏美术";
my $ustring2 = quotemeta $ustring1;
my $rc = 0xffff & system("echo a > $ustring1.txt2");
print "$ustring1\n" ;
print "$ustring2\n";
print "$rc";
print "\n";
The output is fine now. But the filename of the txt2 file is wrong: 游??美术.txt2. Please help