in reply to Re: Perl / FileFind or ...
in thread Perl / FileFind or ...

Yea Tom, that be exactly the issue.

Since PerlMonks offers threaded discussions, it is important to reply to the correct node by clicking the [reply] alongside the node of interest

Guess I just don't get it, Why such a simple thing is so difficult.

Decode the input, Encode the output, read perlunitut: Unicode in Perl#I/O flow (the actual 5 minute tutorial) and learn about your shell

$ chcp Active code page: 437 $ echo > "da-MötleyCrüe" $ dir /b "da-*" da-MötleyCrüe $ dir /b "da-*" | perl -MData::Dump -e " dd[<>] " ["da-M\x94tleyCr\x81e\n"] $ perl -MData::Dump -e " dd[ glob q/da-*/ ] " ["da-M\xF6tleyCr\xFCe"]

Single byte encoding can be hard to guess

$ perl -MEncode::Detective=detect -le " die detect( glob q/da-*/ ) " windows-1252 at -e line 1. $ perl -MEncode::Guess -e " die guess_encoding( glob q/da-*/ ) " No appropriate encodings found! at -e line 1. $ dir /b "da-*" | perl -MEncode::Detective=detect -e " $f = <>; die de +tect($f ) " Died at -e line 1, <> line 1. $ dir /b "da-*" | perl -MEncode::Guess -e " $f = <>; die guess_encodin +g($f ) " No appropriate encodings found! at -e line 1, <> line 1. $ dir /b "da-*" | perl -MEncode::Guess -e " $f = <>; die guess_encodin +g($f , q/cp437/) " Encode::XS=SCALAR(0x9a622c) $ dir /b "da-*" | perl -MEncode::Guess -e " $f = <>; die guess_encodin +g($f , q/cp437/)->name " cp437 at -e line 1, <> line 1.

But once you know, just binmode
$ perl -le " print for glob q/da-*/ "
da-M÷tleyCrⁿe

$ perl -le " binmode STDOUT , q/:encoding(cp437)/; print for glob q/da-*/ "
da-MötleyCrüe

$ perl -Mopen=:std,encoding(cp437) -le " print for glob q/da-*/ "
da-MötleyCrüe

$ perl -MEncode::Locale -le " binmode STDOUT, q{encoding(console_out)}; print for glob q/da-*/ "
da-MötleyCrüe