hi, all,
I have a tk program, I allow user select a file and then I read it. When the
file path contain chinese character(of course, I use windows xp simplified
chinese version with ActiveState perl 5.8.4), perl complain "Invalid argumen" or
"No such file or directory". I know maybe I should use some encoding routines, I
whick I should use?
 
the follow are some code:
 
use strict;
use warnings;
use Tk;
use encoding "cp936", STDOUT => "cp936", STDIN => "cp936"; # simplified chinese
use code page 936

#...
 
sub Transfer($$)
{
 my ($in, $out) = @_;    # $in is user specified, if I use a hard-coded path,
its OK!
 print "$in\n";
 open IN, "<$in" or $main->messageBox(-title => 'Error', 
  -message => "Cannot open file \"$in\" to read: $!", 
  -type => 'OK', -icon => 'info') and return;
 #...
}
 

-----------------------------------------------
Life is a different teacher... 
It doesn't teach lessons, and then keep exams... 
It keeps the exams first and then teaches the lessons.


 

Reply via email to