On 2009-Aug-19, at 5:00 am, Troels Liebe Bentsen wrote:
My idea of working with file names would be that we default to locale or filesystem settings, but give the options of working with paths/file names as
binary or a specific encoding.

As mentioned in the old thread, encoding is only vaguely related to locale. The problem (or one of them) is that if I create a file today, and then change my locale tomorrow, I end up with a garbled filename. Of course, people don't as a rule change to a different locale every day, but I still think this is a situation where we need to put the onus on the user.

That is, either Perl can determine the encoding (e.g. because the filesystem indicates it in some way), or else the user needs to pick one explicitly. If you get a list of files from reading a dir, and don't need to display the names or anything, you might get away with treating them as undistinguished bytes; but as soon as Perl does anything that needs an encoding and one hasn't been specified, it should complain bitterly.

It's the same reasoning why I think specifying a timezone should be required: it's not that much work for the user to add "use IO::Encoding $volume => <utf-8>", and at least that way naive users will be alerted to the fact that something's going on. It's up to them how much effort they think is worth devoting to the issue, but at least they will be warned that there's an issue there to grapple with.


-David

Reply via email to