perl-diddler has asked for the wisdom of the Perl Monks concerning the following question:
The output read in from STDIN is correct -- how do I get the output from readdir to be correct -- NOTE: the filenames returned by readdir aren't usable (i.e. testing them with "-f" or such returns "no such file"....)...> 'ls' -1|tail -6 |perl -CSD -e'use 5.14.0; while (<>) { print } print "opening dir\n"; opendir(my $dh, "."); my @files = grep { /^[^.]/ } readdir $dh; my @sfiles=sort @files; my $start= @sfiles-6; for (my $i=$start; $i<@sfiles;++$i) { printf "%s\n", ${sfiles[$i]}; } ' zwadobef.ttf -chan.ttf みかちゃん-p.ttf みかちゃん-pb.ttf みかちゃん-ps.ttf みかちゃん.ttf opening dir zwadobef.ttf œ-chan.ttf み‹ち‚ƒ‚“-p.ttf み‹ち‚ƒ‚“-pb.ttf み‹ち‚ƒ‚“-ps.ttf み‹ち‚ƒ‚“.ttf
Unfortunately you'll have to imagine how this would look, since <code> doesn't protect unicode chars... it encodes them. The first bit of output doesn't look that way on a terminal... it outputs japanese hiragana characters...
Where does someone file a bug against perlmonks?...sigh...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: how to unicode filenames?
by Corion (Patriarch) on Jun 27, 2012 at 09:23 UTC | |
by perl-diddler (Chaplain) on Jun 27, 2012 at 10:04 UTC | |
by Corion (Patriarch) on Jun 27, 2012 at 11:10 UTC | |
by perl-diddler (Chaplain) on Jun 28, 2012 at 01:00 UTC | |
by Corion (Patriarch) on Jun 28, 2012 at 07:05 UTC | |
|
Re: how to unicode filenames?
by zentara (Cardinal) on Jun 27, 2012 at 10:30 UTC | |
by perl-diddler (Chaplain) on Jun 28, 2012 at 01:04 UTC | |
by zentara (Cardinal) on Jun 28, 2012 at 08:42 UTC | |
by Corion (Patriarch) on Jun 28, 2012 at 09:01 UTC | |
| |
by perl-diddler (Chaplain) on Jun 28, 2012 at 18:13 UTC | |
|
Re: how to unicode filenames?
by Anonymous Monk on Jun 27, 2012 at 09:29 UTC |