eff_i_g has asked for the wisdom of the Perl Monks concerning the following question:
Monks,
I'm working on a Unix (Solaris) system with a file that has non-ASCII characters in its name. When I perform an ls the file name shows as 06_Protection_de_la_tête.xml and my locale is as follows:
LANG= LC_CTYPE=en_US.ISO8859-1 LC_NUMERIC=en_US.ISO8859-1 LC_TIME=en_US.ISO8859-1 LC_COLLATE=en_US.ISO8859-1 LC_MONETARY=en_US.ISO8859-1 LC_MESSAGES=C LC_ALL=
When I work with this file in Perl everything is OK until Tk (Tk::ExecuteCommand) enters the scene as shown/described below:
use warnings; use strict; use Tk; my $file = '06_Protection_de_la_tête.xml'; my $cmd = "ls -l $file"; ### This works. print qx($cmd); ### So does this. open my $F, '<', $file or die $!; print scalar <$F>; ### This fails. ### An error message states that the file cannot be found and the ### "LATIN SMALL LETTER E WITH CIRCUMFLEX" is shown in UTF-8. my $mw = MainWindow->new; my $exec = $mw->ExecuteCommand( -command => $cmd, )->pack; $exec->execute_command; $exec->update; MainLoop;
Here's the erroneous output:
06_Protection_de_la_tête.xml: No such file or directory
I've dug through Tk::ExecuteCommand and I cannot figure out why this error is surfacing.
Any ideas or pointers?
Thanks!
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Tk and Non-ASCII File Names
by zentara (Archbishop) on Sep 27, 2010 at 19:53 UTC | |
by eff_i_g (Curate) on Sep 28, 2010 at 15:43 UTC | |
by zentara (Archbishop) on Sep 28, 2010 at 16:47 UTC | |
by graff (Chancellor) on Sep 30, 2010 at 02:34 UTC | |
by eff_i_g (Curate) on Oct 06, 2010 at 17:22 UTC | |
by graff (Chancellor) on Oct 08, 2010 at 06:51 UTC | |
| |
Re: Tk and Non-ASCII File Names
by perl-diddler (Chaplain) on Sep 27, 2010 at 17:44 UTC | |
by eff_i_g (Curate) on Sep 27, 2010 at 18:33 UTC |
Back to
Seekers of Perl Wisdom