If you try this in a Windows command-line, after creating a directory with a non-ascii character in the name (suppose "München" for a change), and try it consecutively as :#!/usr/bin/perl use strict; use strict; use warnings; use Encode; my $topdir; if (scalar(@ARGV)) { $topdir = shift @ARGV; } else { print "Enter top dir : "; $topdir = <>; chomp $topdir; } warn("top directory [$topdir] : ",(Encode::is_utf8($topdir) ? '(ut +f8)' : '(bytes)')); unless (opendir(DIR,$topdir)) { die ("Could not open it : $!"); } closedir DIR; warn "everything ok"; exit 0;
This might be the deep cause of my problems, because in the real program, I am getting the name of the top directory of my tree by parsing a parameter file, and they come to perl as utf8 strings. But the subdirectory names that I read from the disk, come in as bytes. Now when I concatenate both to get a full filename, I believe I have a problem.
In reply to Re^2: directories and charsets
by soliplaya
in thread directories and charsets
by soliplaya
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |