in reply to Re: directories and charsets
in thread directories and charsets
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: directories and charsets
by jbert (Priest) on Mar 15, 2007 at 17:59 UTC | |
by soliplaya (Beadle) on Mar 15, 2007 at 21:18 UTC |