in reply to find scalar encoding

This is bad news for you: You can't reliably determine the encoding of a scalar.

On Windows you could try to query the current codepage somehow, and hope that the filename is in that codepage (I don't think it's guaranteed though), on Unix systems you could try the current locale - but then again you can't blindly assume that it reflects the encoding of the file name.

If you have a narrow selection of possible encodings, you can use Encode::Guess to determine which one is most likely correct, but it's only a heuristic, and usually doesn't work well on such short strings as file names.

Replies are listed 'Best First'.
Re^2: find scalar encoding
by dHarry (Abbot) on Sep 09, 2008 at 12:55 UTC

    On Windows you can try your luck with Win32::Locale and more likely Win32::Codepage to obtain the information your looking for.

    However, if you want to write * portable * Perl code then it is probably better not to use file globbing altogether. See perlport.html section "System Interaction".

      perl on windows doesn't support unicode filenames directly
Re^2: find scalar encoding
by rastakouair (Initiate) on Sep 09, 2008 at 15:36 UTC
    Thanks everybody for your quick answers!
    Finally I used Encode::Guess and it works for me...I don't really know if it will on other computers...
    I also changed glob function for opendir