http://qs1969.pair.com?node_id=830974


in reply to Re^2: encoding of file names
in thread encoding of file names

I still don't understand what to specify as the from encoding.

Usually, the file names are text encoded as per the local's encoding. In fact, I dare say that's the expectation.

Most users have a UTF-8 locale. You could assume UTF-8, and worry about it when someone complains.

If you want to actually get the right encoding, your best bet is probably the following undocumented function:

require encoding; # Or "use encoding ();" with the parens. my $locale_encoding = encoding::_get_locale_encoding();

This is what core module open uses.

And since you mention it, i actually am curious about Windows

It's a real mess. Bad support by builtins and by modules for accessing Windows's wide character interface. Bad support at finding the code page (last time I checked) of the single-byte interface (even though it's easier than locales in unix). Maybe some other time.